Skip to content

Commit

Permalink
fix bug with dkim signing messages without Date or Message-Id header
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mjl- committed Jun 4, 2023
1 parent c9a846d commit e53b773
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion smtpserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e53b773

Please sign in to comment.