for dmarc reporting, be more conservate with sending reports to junky senders, and format textual dmarc report period in the message text in utc as claimed

before this change, a message in the rejects folder that was read and marked as
notjunk (e.g. automatically by webmail), could cause a dmarc report to be sent
for another junky message from the domain. we now require positive signals to
be for messages not in the rejects mailbox.

the text/plain body of a dmarc report contains the period, but it was in local
time while claiming to be in utc. make it utc, so we often get nicely rounded
whole 24h utc days.
This commit is contained in:
Mechiel Lukkien 2023-11-04 23:24:47 +01:00
parent c955fadb6d
commit 2abac1a911
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View file

@ -728,8 +728,8 @@ specified in the "rua" field of the DMARC record for your domain.
Report domain: %s Report domain: %s
Submitter: %s Submitter: %s
Report-ID: %s Report-ID: %s
Period: %s - %s in UTC Period: %s - %s UTC
`, dom, mox.Conf.Static.HostnameDomain, report.ReportMetadata.ReportID, beginTime.Format(time.DateTime), endTime.Format(time.DateTime)) `, dom, mox.Conf.Static.HostnameDomain, report.ReportMetadata.ReportID, beginTime.UTC().Format(time.DateTime), endTime.UTC().Format(time.DateTime))
// The attached file follows the naming convention from the RFC. ../rfc/7489:1812 // The attached file follows the naming convention from the RFC. ../rfc/7489:1812
reportFilename := fmt.Sprintf("%s!%s!%d!%d!%s.xml.gz", mox.Conf.Static.HostnameDomain.ASCII, dom.ASCII, beginTime.Unix(), endTime.Add(-time.Second).Unix(), report.ReportMetadata.ReportID) reportFilename := fmt.Sprintf("%s!%s!%d!%d!%s.xml.gz", mox.Conf.Static.HostnameDomain.ASCII, dom.ASCII, beginTime.Unix(), endTime.Add(-time.Second).Unix(), report.ReportMetadata.ReportID)

View file

@ -2480,6 +2480,7 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
q := bstore.QueryTx[store.Message](tx) q := bstore.QueryTx[store.Message](tx)
q.FilterNonzero(store.Message{MsgFromOrgDomain: m.MsgFromOrgDomain}) q.FilterNonzero(store.Message{MsgFromOrgDomain: m.MsgFromOrgDomain})
q.FilterEqual("Notjunk", true) q.FilterEqual("Notjunk", true)
q.FilterEqual("IsReject", false)
exists, err := q.Exists() exists, err := q.Exists()
if err != nil { if err != nil {
return fmt.Errorf("querying for non-junk message from organizational domain: %v", err) return fmt.Errorf("querying for non-junk message from organizational domain: %v", err)