OpenDKIM and Postfix on Debian 7

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

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

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

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

Create tables
nano /etc/opendkim/KeyTable paste in example.com:example:/etc/opendkim/example.com/example.private
nano /etc/opendkim/SigningTable paste in *@example.com example.com
nano /etc/opendkim/TrustedHosts with a trusted host on each line including 127.0.0.1

CHOWN

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/main.cf

# 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 *