This guide is based off of these pages :

  • http://www.howtoforge.com/set-up-dkim-for-multiple-domains-on-postfix-with-dkim-milter-2.8.x-centos-5.3
  • http://www.howtoforge.com/set-up-dkim-on-postfix-with-dkim-milter-centos-5.2

Process

  • Enable the EPEL yum
  • Install dkim-milter
    sudo yum install dkim-milter
    
  • Generate keys
    dkim-genkey -r -d example.com
    sudo mkdir /etc/mail/dkim-milter/keys/example.com
    sudo mv default.private /etc/mail/dkim-milter/keys/example.com/default
    sudo mv default.txt /etc/mail/dkim-milter/keys/example.com/
    sudo chown -R dkim-milter:dkim-milter /etc/mail/dkim-milter/keys/example.com
    
  • Paste the contents of default.txt into your zone file
    cat /etc/mail/dkim-milter/keys/example.com/default.txt >> /var/named/chroot/var/named/example.com.hosts
    
  • Modify your zone file’s serial number to reflect that fact that you’ve changed it. This is necessary for the changes to be propogated
  • Change settings in /etc/mail/dkim-milter/dkim-filter.conf.orig
    • AutoRestart yes
    • Domain example.com
    • Selector default
    • Socket inet:20209@localhost
    • Syslog Yes
    • X-Header Yes
  • Modify /etc/mail/dkim-milter/keys/keylist
    *@example.com:example.com:/etc/mail/dkim-milter/keys/example.com/default
    
  • Modify /etc/postfix/main.cf
    # dkim-milter setup
    smtpd_milters = inet:localhost:20209
    non_smtpd_milters = inet:localhost:20209
    milter_protocol = 2
    milter_default_action = accept
    
  • Tell dkim-filter to listen on a port instead of a socket. This is required because the init script hard codes to a socket and doesn’t respect the setting in the /etc/mail/dkim-milter/dkim-milter.conf file.
    sudo echo "SOCKET=inet:20209@localhost" >>/etc/sysconfig/dkim-milter
    
  • Start it up
    sudo service dkim-milter start
    sudo service postfix restart
    sudo service named reload
    
  • Test it out