DKIM with postfix
Install DKIM
# yum install opendkim
Backup the original conf file.
# cp /etc/opendkim.conf{,.bak}
Open /etc/opendkim.conf and make it look like below:
AutoRestart Yes AutoRestartRate 10/1h LogWhy Yes Syslog Yes SyslogSuccess Yes Mode sv Canonicalization relaxed/simple ExternalIgnoreList refile:/etc/opendkim/TrustedHosts InternalHosts refile:/etc/opendkim/TrustedHosts KeyTable refile:/etc/opendkim/KeyTable SigningTable refile:/etc/opendkim/SigningTable SignatureAlgorithm rsa-sha256 Socket inet:8891@localhost PidFile /var/run/opendkim/opendkim.pid UMask 022 UserID opendkim:opendkim TemporaryDirectory /var/tmp
Generate keys
# mkdir /etc/opendkim/keys/example.com # opendkim-genkey -D /etc/opendkim/keys/example.com/ -d example.com -s default # chown -R opendkim: /etc/opendkim/keys/example.com # mv /etc/opendkim/keys/example.com/default.private /etc/opendkim/keys/example.com/default
Open the file /etc/opendkim/KeyTable and add the following lines but with your domain instead of example.com:
default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com/default
Open the file /etc/opendkim/SigningTable and add the following line:
*@example.com default._domainkey.example.com
Open the file /etc/opendkim/TrustedHosts and make sure you have:
127.0.0.1 mydomain.com host.mydomain.com
Note: host.mydomain.com should be your actual hostname.