From e53b773d048cc7b1cc8f21d1c29aeb629aa80da4 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sun, 4 Jun 2023 20:32:18 +0200 Subject: [PATCH] fix bug with dkim signing messages without Date or Message-Id header we were adding the missing date and/or message-id header, but didn't sign it. and the default dkim signing config is to (over)sign those headers. so that was causing errors with bad signatures. found while setting up automated tests for quickstart, while sending a very basic message between a fresh install. --- smtpserver/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtpserver/server.go b/smtpserver/server.go index 3c9b070..85b88c5 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -1755,7 +1755,7 @@ func (c *conn) submit(ctx context.Context, recvHdrFor func(string) string, msgWr if len(dkimConfig.Sign) > 0 { if canonical, err := mox.CanonicalLocalpart(msgFrom.Localpart, confDom); err != nil { c.log.Errorx("determining canonical localpart for dkim signing", err, mlog.Field("localpart", msgFrom.Localpart)) - } else if dkimHeaders, err := dkim.Sign(ctx, canonical, msgFrom.Domain, dkimConfig, c.smtputf8, dataFile); err != nil { + } else if dkimHeaders, err := dkim.Sign(ctx, canonical, msgFrom.Domain, dkimConfig, c.smtputf8, store.FileMsgReader(msgPrefix, dataFile)); err != nil { c.log.Errorx("dkim sign for domain", err, mlog.Field("domain", msgFrom.Domain)) metricServerErrors.WithLabelValues("dkimsign").Inc() } else {