Score:1

Postfix from rewriting (smtp_generic_maps) + DKIM

cn flag

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
anx avatar
fr flag
anx
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.