OpenDKIM and Postfix on Debian 7

Install it
apt-get update; apt-get install opendkim opendkim-tools

Create config dirs
mkdir -pv /etc/opendkim/; chown -Rv opendkim:opendkim /etc/opendkim; chmod go-rwx /etc/opendkim/*

Generate Keys and Set Permissions
cd /etc/opendkim/; opendkim-genkey -r -h rsa-sha256 -d -s example; chown opendkim:opendkim *; chmod u=rw,go-rwx *

Create DNS TXT Record
cat /etc/opendkim/
Create a DNS record wtih the contents of the zone file above

Create tables
nano /etc/opendkim/KeyTable paste in
nano /etc/opendkim/SigningTable paste in *
nano /etc/opendkim/TrustedHosts with a trusted host on each line including


chown opendkim:opendkim /etc/opendkim/KeyTable
chown opendkim:opendkim /etc/opendkim/SigningTable
chown opendkim:opendkim /etc/opendkim/TrustedHosts

Edit /etc/opendkim.conf changing things as needed

Add this to /etc/postfix/

# OpenDKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = $smtpd_milters

Restart postfix

Restart opendkim

Leave a Reply

Your email address will not be published. Required fields are marked *