HOWTO Setup dkim-milter with postfix under CentOS 5

This guide is based off of these pages :

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
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 08, 2011

    Anonymous says:

    Super - I'm very happy. After spending many days on other solutions. Now it work...

    Super - I'm very happy. After spending many days on other solutions.
    Now it works very fine - thank you ver much !!!

  2. Sep 21, 2011

    Anonymous says:

    dkim-milter development has been abandoned for years, and has been replaced with...

    dkim-milter development has been abandoned for years, and has been replaced with OpenDKIM (http://opendkim.org/), an open source project that was forked from dkim-milter in 2009.

    Packages are available in the Fedora and EPEL repos. For RHEL/CentOS users, if you have EPEL enabled, just do "sudo yum install opendkim"

    Gene - would you consider updating your wiki entry to refer to OpenDKIM instead? The configuration is almost identical, and OpenDKIM provides a couple years' worth of bugfixes and new features. Thanks.

  3. Nov 26, 2011

    Anonymous says:

    Hi, I have followed the same steps but get the following error: $ sudo servic...

    Hi,

    I have followed the same steps but get the following error:

    $ sudo service dkim-milter start
    Starting DomainKeys Identified Mail Milter (dkim-filter): dkim-filter: /etc/mail/dkim-milter/dkim-filter.conf: configuration error at line 0: error reading configuration file
                                                               [FAILED]
    $ sudo service postfix restart
    Shutting down postfix:                                     [  OK  ]
    Starting postfix:                                          [  OK  ]
    $ sudo service named reload
    Reloading named:                                           [  OK  ]
    Please help, thanks in advance.