Add the new domain through the iredadmin panel – hostdomain.com/iredadmin

Server

1. Generate domain keys for the new domain:

amavisd-new genrsa /var/lib/dkim/newdomain.co.uk.pem

2. Edit the amavis conf file:

vim /etc/amavis/conf.d/50-user

Change @local_domains_maps = 1; to:

@local_domains_maps = ['.'];

Also add the following line below “# Add dkim_key here”:

dkim_key("newdomain.co.uk", "dkim", "/var/lib/dkim/newdomain.co.uk.pem");

3. Restart amavis:

/etc/init.d/amavis restart

4. Show the new domain key to add to DNS:

amavisd-new showkeys newdomain.co.uk

; key#2, domain newdomain.com, /var/lib/dkim/newdomain.com.pem
dkim._domainkey.newdomain.com. 3600 TXT (
"v=DKIM1; p="
"xxxxxxxxxxxxxxxxxxxxxxxxxxCBiQKBgQDI7mVZUl7C2OE/7O3NBSyuLANP"
"wfZSk8BdQiGlBe3uzxxxxxxxxxxxxxxxxxxxxxx45aT4watrSf3R7kkXBVtrhS"
"1mMwEXxqMy+9b9AMJN43GU/oD2MoNBPklp2tWv1mViCMSl9j9k1znK0dKcbANtmg"
"38xxxxxxxxxxxxxxxx")

Copy the resultant domain key to newdomain.co.uk as a TXT record (remove all quotation marks) e.g.

dkim._domainkey.newdomain.co.uk.
v=DKIM1; p=xxxxxxxxxxxxxxxxxxxxxxxxxxCBiQKBgQDI7mVZUl7C2OE/7O3NBSyuLANPwfZSk8BdQiGlBe3uzxxxxxxxxxxxxxxxxxxxxxx45aT4watrSf3R7kkXBVtrhS1mMwEXxqMy+9b9AMJN43GU/oD2MoNBPklp2tWv1mViCMSl9j9k1znK0dKcbANtmg38xxxxxxxxxxxxxxxx

TEST

amavisd-new testkeys

This should show:

TESTING#2: dkim._domainkey.newdomain.co.uk => pass

If the above test fails, perform a dig to make sure TXT record has propagated:

dig -t txt dkim._domainkey.newdomain.co.uk

Also, use http://dkimvalidator.com/ to verify emails are being signed.

Written by Matt Cooper
Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: matt@linuxtutorial.co.uk.