1

We have SMTP server for the application emails what should do following:

  1. change “From” for all emails
  2. sign emails with DKIM

I have set up postfix rewriting with smtp_generic.

The default flow is like that:

  1. Email comes to postfix
  2. OpenDKIM will sign it
  3. smtp_generic_maps will change the header
  4. email will be delivered

The problem: by default setup smtp_generic_maps will overwrite the DKIM header.

Any suggestion? Examples, how change order? Master.cf examples are very welcome. I imagine that one way could to createe separate postfix instances for both tasks. One that will do the „From“ rewriting (smtp_generic_maps) and second instance will add DKIM and sent it out.

Similar issue is here, sadly no examples from master.cf file ☹

Chook posts: "I solved this problem by using the postfix advanced filter and adding the opendkim milter on the final phase."

Postfix generic changes causing DKIM permerror

Configuration are:

main.cf

# Milter configuration
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters

opendkim.conf

PidFile /run/opendkim/opendkim.pid
Mode sv
Syslog  yes
SyslogSuccess   yes
LogWhy  yes
UserID  opendkim:opendkim
Socket  inet:8891@localhost
Umask   002
SendReports yes
SoftwareHeader  yes
Canonicalization    relaxed/relaxed
Selector    default
MinimumKeyBits  1024
KeyTable    /etc/opendkim/KeyTable
SigningTable    refile:/etc/opendkim/SigningTable
ExternalIgnoreList  refile:/etc/opendkim/TrustedHosts
InternalHosts   refile:/etc/opendkim/TrustedHosts
OversignHeaders From
Juhani
  • 11
  • 1
  • Are you really certain that you want to rewrite address headers? You save yourself a whole bunch of other edge cases if sending software already knows and uses the header that gets sent out, and postfix merely verifies (& rejects misconfigured) senders. – anx Jun 14 '21 at 16:47

0 Answers0