Monthly Archives: May 2013

OpenDKIM – multiple domains

Install OpenDKIM

apt-get install opendkim

Configure OpenDKIM

vim /etc/opendkim.conf

KeyTable           /etc/opendkim/KeyTable
SigningTable       /etc/opendkim/SigningTable
ExternalIgnoreList /etc/opendkim/TrustedHosts
InternalHosts      /etc/opendkim/TrustedHosts
LogWhy yes

vim /etc/opendkim/TrustedHosts

127.0.0.1
localhost
external IP
externalnet IP/prefix

Edit /etc/default/opendkim

vim /etc/default/opendkim

SOCKET=”inet:11223@localhost”

Generate key for domains (ex. domain.tld, domain2.tld )

# domain.tld

mkdir -p /etc/opendkim/keys/domain.tld
cd /etc/opendkim/keys/domain.tld
opendkim-genkey -r -d domain.tld
chown opendkim:opendkim default.private

# domain2.tld

mkdir -p /etc/opendkim/keys/domain2.tld
cd /etc/opendkim/keys/domain2.tld
opendkim-genkey -r -d domain2.tld
chown opendkim:opendkim default.private

Add domains to KeyTable

vim /etc/opendkim/KeyTable

default._domainkey.domain.tld domain.tld:default:/etc/opendkim/keys/domain.tld/default.private
default._domainkey.domain2.tld domain2.tld:default:/etc/opendkim/keys/domain2.tld/default.private

Add domains to SigningTable

vim /etc/opendkim/SigningTable

domain.tld default._domainkey.domain.tld
domain2.tld default._domainkey.domain2.tld

Add to DKIM public key to DNS

# domain.tld
cat /etc/opendkim/keys/domain.tld/default.txt

# domain2.tld
cat /etc/opendkim/keys/domain2.tld/default.txt

Start OpenDKIM

/etc/init.d/opendkim start

Configure Postfix

vim /etc/postfix/main.cf

milter_default_action = accept
milter_protocol = 6 ( Postfix ≥ 2.6 milter_protocol = 6, Postfix ≤ 2.5 milter_protocol = 2 )
smtpd_milters = inet:localhost:11223
non_smtpd_milters = inet:localhost:11223

Reload Postfix

/etc/init.d/postfix reload

Testing

Send a signed email to: check-auth@verifier.port25.com