From 919ee46ba4a0c7180d86712467a3179ca8705df5 Mon Sep 17 00:00:00 2001 From: Aine Date: Wed, 16 Nov 2022 10:25:26 +0200 Subject: [PATCH] do not leak domain in multi-domain mode --- smtp/manager.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/smtp/manager.go b/smtp/manager.go index 217886d..db94d32 100644 --- a/smtp/manager.go +++ b/smtp/manager.go @@ -58,13 +58,16 @@ func NewManager(cfg *Config) *Manager { cfg.Bot.SetSendmail(mailsrv.SendEmail) s := smtp.NewServer(mailsrv) - s.Domain = cfg.Domains[0] s.ReadTimeout = 10 * time.Second s.WriteTimeout = 10 * time.Second s.MaxMessageBytes = cfg.MaxSize * 1024 * 1024 s.AllowInsecureAuth = !cfg.TLSRequired s.EnableREQUIRETLS = cfg.TLSRequired s.EnableSMTPUTF8 = true + // set domain in greeting only in single-domain mode + if len(cfg.Domains) == 1 { + s.Domain = cfg.Domains[0] + } if log.GetLevel() == "DEBUG" || log.GetLevel() == "TRACE" { s.Debug = os.Stdout }