In the process of migrating my mail server to a new host. One of my struggles is OpenDKIM isn't signing outgoing mail (not internal). Currently my TrustedHosts
file is as follows:
127.0.0.1
::1
localhost
*.example.com
(Where example.com is my mail domain.)
I'm sending mail from my IMAP client from my phone. If I add my phone's IP, the message signs properly.
A number of tutorials I've seen run this layout, and is what I've had configure until the migration. Am I really to wildcard all hosts? What's the recommended configuration?
You should not be signing messages based on the originating hosts but only for authenticated users. Your question revolves around a single configuration parameter and does not really tell how your Postfix is configured and how OpenDKIM is integrated to it.
All mail user agents (MUA) should send mail through a separate
smtpd
instance (smtps
on port 465). This instance should require SASL authentication, and as it is implicit TLS for SMTP submission (RFC 8314, 3.3) it is also secured by TLS. Inmaster.cf
you could have, e.g.:It might be a good idea to further restrict that your users should not be using email addresses of other users by adding, e.g., these parameters:
Now, as all mail from this instance is authenticated, you can sign it regardless of the IP address. The following configuration is an example that adds the OpenDKIM milter assuming it is listening on
localhost:8891
, continues without signing in case the milter is temporarily unavailable, and tells the milter that it should work in the signing mode (ORIGINATING
).(For the inbound mail on the
smtpd
instance on port 25 you should have themilter_macro_daemon_name
set toVERIFYING
, instead.)