https://docs.iredmail.org/sign.dkim.signature.for.new.domain.html


Generate new DKIM key for new mail domain
amavisd-new genrsa /var/lib/dkim/new_domain.com.pem 1024
chown amavis:amavis /var/lib/dkim/new_domain.com.pem
chmod 0400 /var/lib/dkim/new_domain.com.pem


    Find below setting in Amavisd config file amavisd.conf:

dkim_key('mydomain.com', "dkim", "/var/lib/dkim/mydomain.com.pem");

Add one line after above line like below:

dkim_key('new_domain.com', "dkim", "/var/lib/dkim/new_domain.com.pem");

    Find below setting in Amavisd config file amavisd.conf:

@dkim_signature_options_bysender_maps = ( {
    ...
    "mydomain.com"  => { d => "mydomain.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    ...
});

Add one line after "mydomain.com" line like below:

@dkim_signature_options_bysender_maps = ( {
    ...
    "mydomain.com"  => { d => "mydomain.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    "new_domain.com"  => { d => "new_domain.com", a => 'rsa-sha256', ttl => 10*24*3600 },
    ...
});

    Restart Amavisd service.

Again, don't forget to add DKIM DNS record for this new domain. The value of DKIM record can be checked with command below:

# amavisd-new showkeys

After added DKIM DNS record, please verify it with command:

# amavisd-new testkeys
