From 87854cfde3eff05b1d580ddae8b32846538814a5 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sat, 11 Feb 2023 23:54:22 +0100 Subject: [PATCH] change some log levels from info to debug, and use lower case log messages --- imapserver/server.go | 4 ++-- junk/filter.go | 2 +- queue/queue.go | 2 +- smtpserver/analyze.go | 10 +++++----- smtpserver/server.go | 12 ++++++------ store/train.go | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/imapserver/server.go b/imapserver/server.go index cfb6ef5..5d29b55 100644 --- a/imapserver/server.go +++ b/imapserver/server.go @@ -1519,7 +1519,7 @@ func (c *conn) cmdAuthenticate(tag, cmd string, p *parser) { xsyntaxErrorf("malformed cram-md5 response") } addr := t[0] - c.log.Info("cram-md5 auth", mlog.Field("address", addr)) + c.log.Debug("cram-md5 auth", mlog.Field("address", addr)) acc, _, err := store.OpenEmail(addr) if err != nil { if errors.Is(err, store.ErrUnknownCredentials) { @@ -1586,7 +1586,7 @@ func (c *conn) cmdAuthenticate(tag, cmd string, p *parser) { if err != nil { xsyntaxErrorf("starting scram: %w", err) } - c.log.Info("scram auth", mlog.Field("authentication", ss.Authentication)) + c.log.Debug("scram auth", mlog.Field("authentication", ss.Authentication)) acc, _, err := store.OpenEmail(ss.Authentication) if err != nil { // todo: we could continue scram with a generated salt, deterministically generated diff --git a/junk/filter.go b/junk/filter.go index af197bd..8e96f0a 100644 --- a/junk/filter.go +++ b/junk/filter.go @@ -255,7 +255,7 @@ func (f *Filter) Save() error { return words[i] < words[j] }) - f.log.Info("inserting words in junkfilter db", mlog.Field("words", len(f.changed))) + f.log.Debug("inserting words in junkfilter db", mlog.Field("words", len(f.changed))) // start := time.Now() if f.isNew { if err := f.db.HintAppend(true, wordscore{}); err != nil { diff --git a/queue/queue.go b/queue/queue.go index 4513ece..451ce13 100644 --- a/queue/queue.go +++ b/queue/queue.go @@ -568,7 +568,7 @@ func deliver(resolver dns.Resolver, m Msg) { if !ok && badTLS && tlsMode == smtpclient.TLSOpportunistic { // In case of failure with opportunistic TLS, try again without TLS. ../rfc/7435:459 // todo future: revisit this decision. perhaps it should be a configuration option that defaults to not doing this? - nqlog.Info("connecting again for delivery attempt without TLS") + nqlog.Info("connecting again for delivery attempt without tls") permanent, badTLS, secodeOpt, remoteIP, errmsg, ok = deliverHost(nqlog, resolver, cid, h, &m, smtpclient.TLSSkip) } if ok { diff --git a/smtpserver/analyze.go b/smtpserver/analyze.go index 34ee5b6..b6d7cbd 100644 --- a/smtpserver/analyze.go +++ b/smtpserver/analyze.go @@ -98,7 +98,7 @@ func analyze(ctx context.Context, log *mlog.Log, resolver dns.Resolver, d delive if d.rcptAcc.destination.DMARCReports { // Messages with DMARC aggregate reports must have a dmarc pass. ../rfc/7489:1866 if d.dmarcResult.Status != dmarc.StatusPass { - log.Info("received DMARC report without DMARC pass, not processing as DMARC report") + log.Info("received dmarc report without dmarc pass, not processing as dmarc report") } else if report, err := dmarcrpt.ParseMessageReport(store.FileMsgReader(d.m.MsgPrefix, d.dataFile)); err != nil { log.Infox("parsing dmarc report", err) } else if d, err := dns.ParseDomain(report.PolicyPublished.Domain); err != nil { @@ -130,22 +130,22 @@ func analyze(ctx context.Context, log *mlog.Log, resolver dns.Resolver, d delive } if !ok { - log.Info("received mail to TLSRPT without acceptable DKIM signature, not processing as TLSRPT") + log.Info("received mail to tlsrpt without acceptable DKIM signature, not processing as tls report") } else if report, err := tlsrpt.ParseMessage(store.FileMsgReader(d.m.MsgPrefix, d.dataFile)); err != nil { - log.Infox("parsing TLSRPT report", err) + log.Infox("parsing tls report", err) } else { var known bool for _, p := range report.Policies { log.Info("tlsrpt policy domain", mlog.Field("domain", p.Policy.Domain)) if d, err := dns.ParseDomain(p.Policy.Domain); err != nil { - log.Infox("parsing domain in TLSRPT report", err) + log.Infox("parsing domain in tls report", err) } else if _, ok := mox.Conf.Domain(d); ok { known = true break } } if !known { - log.Info("TLSRPT report without one of configured domains, ignoring") + log.Info("tls report without one of configured domains, ignoring") } else { tlsReport = report } diff --git a/smtpserver/server.go b/smtpserver/server.go index 00d0680..3c78f13 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -985,7 +985,7 @@ func (c *conn) cmdAuth(p *parser) { xsmtpUserErrorf(smtp.C501BadParamSyntax, smtp.SeProto5BadParams4, "malformed cram-md5 response") } addr := t[0] - c.log.Info("cram-md5 auth", mlog.Field("address", addr)) + c.log.Debug("cram-md5 auth", mlog.Field("address", addr)) acc, _, err := store.OpenEmail(addr) if err != nil { if errors.Is(err, store.ErrUnknownCredentials) { @@ -1057,7 +1057,7 @@ func (c *conn) cmdAuth(p *parser) { c0 := xreadInitial() ss, err := scram.NewServer(h, c0) xcheckf(err, "starting scram") - c.log.Info("scram auth", mlog.Field("authentication", ss.Authentication)) + c.log.Debug("scram auth", mlog.Field("authentication", ss.Authentication)) acc, _, err := store.OpenEmail(ss.Authentication) if err != nil { // todo: we could continue scram with a generated salt, deterministically generated @@ -1500,7 +1500,7 @@ func (c *conn) cmdData(p *parser) { if err != nil { c.log.Infox("reverse-forward lookup", err, mlog.Field("remoteip", c.remoteIP)) } - c.log.Info("dns iprev check", mlog.Field("addr", c.remoteIP), mlog.Field("status", iprevStatus)) + c.log.Debug("dns iprev check", mlog.Field("addr", c.remoteIP), mlog.Field("status", iprevStatus)) var name string if revName != "" { name = revName @@ -1804,7 +1804,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW c.log.Errorx("dkim verify", dkimErr) authResAddDKIM("none", "", dkimErr.Error(), nil) } else if len(dkimResults) == 0 { - c.log.Info("dkim verify: no dkim-signature header", mlog.Field("mailfrom", c.mailFrom)) + c.log.Info("no dkim-signature header", mlog.Field("mailfrom", c.mailFrom)) authResAddDKIM("none", "", "no dkim signatures", nil) } for i, r := range dkimResults { @@ -1868,7 +1868,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW }) switch receivedSPF.Result { case spf.StatusPass: - c.log.Info("spf pass", mlog.Field("ip", spfArgs.RemoteIP), mlog.Field("mailfromDomain", spfArgs.MailFromDomain.ASCII)) // todo: log the domain that was actually verified. + c.log.Debug("spf pass", mlog.Field("ip", spfArgs.RemoteIP), mlog.Field("mailfromDomain", spfArgs.MailFromDomain.ASCII)) // todo: log the domain that was actually verified. case spf.StatusFail: if spfExpl != "" { // Filter out potentially hostile text. ../rfc/7208:2529 @@ -1934,7 +1934,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW // todo future: consider enforcing an spf fail if there is no dmarc policy or the dmarc policy is none. ../rfc/7489:1507 } authResults.Methods = append(authResults.Methods, dmarcMethod) - c.log.Info("dmarc verification", mlog.Field("result", dmarcResult.Status), mlog.Field("domain", msgFrom.Domain)) + c.log.Debug("dmarc verification", mlog.Field("result", dmarcResult.Status), mlog.Field("domain", msgFrom.Domain)) // Prepare for analyzing content, calculating reputation. var ipmasked1, ipmasked2, ipmasked3 string diff --git a/store/train.go b/store/train.go index a1beef6..0e0a3b0 100644 --- a/store/train.go +++ b/store/train.go @@ -92,7 +92,7 @@ func (a *Account) RetrainMessage(log *mlog.Log, tx *bstore.Tx, jf *junk.Filter, return nil } - log.Info("updating junk filter", mlog.Field("untrain", untrain), mlog.Field("untrainJunk", untrainJunk), mlog.Field("train", train), mlog.Field("trainJunk", trainJunk)) + log.Debug("updating junk filter", mlog.Field("untrain", untrain), mlog.Field("untrainJunk", untrainJunk), mlog.Field("train", train), mlog.Field("trainJunk", trainJunk)) mr := a.MessageReader(*m) defer mr.Close()