TL;DR Opendkim. Hats off the to folk who do marvelous packing 99.99999% percent of the time.
But sometimes they just get it wrong or at least all documentation regarding the package, does not match up with the behavior the packager intended.
That said, hopefully i will help solve some of these issues here.
I assume you have postfix already working and you are just looking to add dkim support.
Install opendkim
apt-get install opendkim opendkim-tools
Configure systemd service file
cat > /lib/systemd/system/opendkim.service <The specific changes here are lines #9 EnvironmentFile #13 -p $SOCKET
Defaults File
cat > /etc/default/opendkim <Opendkim Config file
cat > /etc/opendkim <Specific changes here are lines #7 hashed out socket file, it simply does not work.
The only way to get opendkim to honour this setting is passing it to the command line #13 of the service file.Modify /etc/postfix/main.cf and add/edit the following lines
smtpd_milters = inet:localhost:12301 non_smtpd_milters = inet:localhost:12301Create referenced folders for your open dkim keys
mkdir -vp /etc/dkimkeys/keysTrustedHosts
cat > /etc/dkimkeys/TrustHosts <SingingTable
cat > /etc/dkimkeys/SigningTable <KeyTable
cat> /etc/dkimkeys/KeyTable <Create private/public key for signing
cd /etc/dkimkeys/keys opendkim-genkey -s default
Your directory should now look like this
Tell systemd to reload the the daemon files and restart
systemctl daemon-reload systemctl restart opendkim systemctl restart postfixDNS
Now go modify your DNS, adding a TXT record ‘default._domainkey‘.
Copy and paste everything between the parenthesis. ( everything here ) into the value field of the TXT recordcat keys/default.txt default._dkim IN TXT ( "v=DKIM1; k=rsa; " "p=MIGfMA0GCSqGSIGNA....BIG LONG DIRTY HASH ....ciaxOhS24T4MFwIDAQAB" ) ; ----- DKIM key default for comEnjoy
Other resources
https://www.google.com/search?q=opendkim+setup