Better TLS Configuration

master
Uriel Fanelli 2023-06-18 19:19:55 +02:00
parent 1af4d062fd
commit 223b65994c
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,6 @@ func init() {
if os.Getenv("USETLS") == "true" { if os.Getenv("USETLS") == "true" {
log.Println("Preparing TLS Keys") log.Println("Preparing TLS Keys")
ZMakecert() ZMakecert()
ZangSmtpServer.ConfigureTLS(CrtFile, KeyFile)
ZangSmtpServer.TLSListener = false ZangSmtpServer.TLSListener = false
ZangSmtpServer.TLSRequired = true ZangSmtpServer.TLSRequired = true
log.Println("Using TLS: ", ZangSmtpServer.TLSRequired) log.Println("Using TLS: ", ZangSmtpServer.TLSRequired)
@ -60,6 +59,8 @@ func main() {
log.Println("Starting the server....") log.Println("Starting the server....")
ZangSmtpServer.ConfigureTLS(CrtFile, KeyFile)
defer log.Println("Shutting down the server") defer log.Println("Shutting down the server")
if err := smtpd.ListenAndServe(ListenAddr, mailHandler, handlerRcpt, AppName, ServerName, ZangSmtpServer); err != nil { if err := smtpd.ListenAndServe(ListenAddr, mailHandler, handlerRcpt, AppName, ServerName, ZangSmtpServer); err != nil {