Using Opendkim with postfix on Debian Buster

Just writing down notes in case I need to do this again.

I have postfix running already, and wanted to add dkim. I serve mail for two domains, which calls for a setup slightly more complicated than the default.

To get dkim working, I followed opendkim on Debian Wiki. It mostly worked, but I had to tweak it a bit, explanations follow:

First, systemd complained so I modified the path to the pid file from /var/run/… to /run/..

Then I had problems with the default socket placement. This article helped fix my problem.

I added the keys to my dns.

Now I have verified it works sending to gmail.

Here is the setup:




And the parts that needed modification of /etc/opendkim.conf:

Socket                  local:/var/spool/postfix/var/run/opendkim/opendkim.sock
PidFile               /run/opendkim/
KeyTable file:/etc/dkimkeys/keytable
SigningTable refile:/etc/dkimkeys/signingtable
InternalHosts refile:/etc/dkimkeys/trustedhosts

And additions to /etc/postfix/

smtpd_milters = unix:/var/run/opendkim/opendkim.sock
non_smtpd_milters = $smtpd_milters

I added dns records for mail2020._domainkey to both my domains, as txt records.