We have SMTP server for the application emails what should do following:
- change “From” for all emails
- sign emails with DKIM
I have set up postfix rewriting with smtp_generic.
The default flow is like that:
- Email comes to postfix
- OpenDKIM will sign it
- smtp_generic_maps will change the header
- 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