This tutorial will help you to setup DomainKeys and postfix configuration on Centos server.
Install EPEL repository:
64 bit:
32 bit:
Install DKIM:
# mkdir /etc/opendkim/keys/linuxpcfix.com
# export domain=linuxpcfix.com
# cd /etc/opendkim/keys/linuxpcfix.com
Generate Private keys as below.
Change the ownership and group for /etc/opendkim/keys/linuxpcfix.com
Copy or edit the below contents in /etc/opendkim/KeyTable
# echo “*@linuxpcfix.com default._domainkey.linuxpcfix.com” >> /etc/opendkim/SigningTable
If you have internal hosts relaying through that you want to sign mail for to:
Edit mail configuration file
Domain linuxpcfix.com
uncomment following lines.
PidFile /var/run/opendkim/opendkim.pid
Mode sv
Syslog yes
SyslogSuccess yes
UserID opendkim:opendkim
Socket inet:8891@localhost
Umask 002
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/TrustedHost
(Search this line: SigningTable /etc/opendkim/SigningTable and modify it to:
SigningTable refile:/etc/opendkim/SigningTable to enable regex wildcards on SigningTable)
Configure Postfix
# opendkim setup
non_smtpd_milters = inet:localhost:8891
milter_default_action = accept
Restart Services
# service postfix restart
# service named reload
# chkconfig opendkim on
Test our setup
# tail -100 /var/log/maillog
Now make sure maillog log shows it signed, check gmail headers of email you sent, make sure everything passes fine.
INPUT_MAIL_FILTER(`opendkim’, `S=inet:8891@localhost’)
