Assuming you are using iRedOS, and the domain is xyz.com:
1. Generate the new key.
cd /var/lib/dkim/
amavisd genrsa xyz.com.pem
chmod 0644 xyz.com.pem
2. Add it to your amavisd.conf file:
Search for "# Add dkim_key here.", and add it alongside the others, preferably in alphabetic order so you can find it faster.
dkim_key("xyz.com", "dkim", "/var/lib/dkim/xyz.com.pem");
3. Add your new domain to @local_domains_maps in amavisd.conf. The line should now read something like this:
@local_domains_maps = ( [".$mydomain", "firstdomain.com", "xyz.com"] ); # list of all local domains
4. Restart amavisd
/etc/init.d/amavisd restart
5. Test that the key was installed properly
The output should be something like this:
; key#1, domain xyz.com, /var/lib/dkim/xyz.com.pem
dkim._domainkey.xyz.com. 3600 TXT (
"v=DKIM1; p="
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEzgjyG2It0ZdQQTgGNj2jNDKe"
"fsa978sd98fsd9vds97v9fHIUSAFHY(#@*oiu7cs98a9"
"afljhljoU(*@#&($*#@U9ujw9fewur0932870932"
"jvAe33lH9tiVljog1QYSUDOEAaads")
6. Add exactly what was printed above to the zone file in you nameserver(s). You should also include SPF and ADSP. For example:
xyz.com. IN TXT "v=spf1 +a +mx ~all"
dkim._domainkey.xyz.com. 3600 TXT (
"v=DKIM1; p="
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEzgjyG2It0ZdQQTgGNj2jNDKe"
"fsa978sd98fsd9vds97v9fHIUSAFHY(#@*oiu7cs98a9"
"afljhljoU(*@#&($*#@U9ujw9fewur0932870932"
"jvAe33lH9tiVljog1QYSUDOEAaads")
_adsp._domainkey.xyz.com. IN TXT "dkim=all"
Make sure you have also updated the serial of the zone file.
Then restart named service:
/etc/init.d/named restart
7. Verify that everything is ok by sending mails from xyz.com to the autoresponders from this page:
DKIM Reflectors.