DKIM is invalid

Hi. I'm unable to get DKIM working.

When I'm enabling DKIM for all Virtual servers, it includes "d=*" in a signed message. DKIM Validators are looking for default._domainkey.* and can't find it, since DNS record is set to As a result - Invalid DKIM and spam folders.

Here validation results:

Can you please suggest what is the issue here, and what am I doing wrong? Please, let me know if any additional information is needed.



Can you attach the /etc/opendkim.conf file from your system to this bug report?

Hi, Jamie!

Thanks for responding. Please see files attached to this post for my opendkim.conf file.


Some additional information:

Operating system: CentOS Linux 7.1.1503
Webmin version: 1.760
Virtualmin version: 4.17.gpl

# opendkim -V 
opendkim: OpenDKIM Filter v2.10.3

# postconf -d | grep mail_version
mail_version = 2.10.1

# named -v
BIND 9.9.4-RedHat-9.9.4-18.el7_1.1 (Extended Support Version)

Almost all settings were default, I just bought this VPS and imported my sites from CPanel backup, plus created some additional top-level virtual servers for new projects. OpenDKIM is installed by Virtualmin. I've installed bind and postfix using yum before installing Virtualmin, but it looks like Virtualmin is fine with it.

The contents of KeyTable, SigningTable and domains are default.


    * default


    default *:default:/etc/opendkim/keys/default.private

Under /etc/dkim-domains.txt there is a list of domains and subdomains in my install.

Let me know if you need additional information I can provide.


After some debugging I've ended up with this solution:

Manually adding for all domains:

SigningTable (/etc/dkim-signingtable):


KeyTable (/etc/dkim-keytable):

*For each domain replace with it.

File permissions were fine, /etc/dkim-domains.txt and opendkim.conf files were edited normally by virtualmin. Enabling/disabling Domain Keys, or reinstalling opendkim had no effect.

The reason may be in file, it may handle incorrectly parked domains from cpanel. In my configuration I had virtual servers structure like this after importing from cpanel backup:
    et cetera

Since now my dkim is fine, I'm stopping further investigation, please, let me know if you'll need additional details, I'll be happy to provide.

Regards, Ruben

If you add another test domain to your system, does Virtualmin create the correct entries in the /etc/dkim-signingtable and /etc/dkim-keytable files?

When I'm adding a test domain, it adds correct DNS entries, adds the domain to /etc/dkim-domains.txt, but signing table and keytable still are not modified. Permissions and owner for keytable, signing table and domains.txt are the same.

It looks like the current Virtualmin code only adds KeyTable and SigningTable entries when a custom key is specified for the domain - otherwise it just uses the * entry in those files. I will look further into why this isn't working though..

I may try to experiment with it later too, I'll post any results I got.



Ok, I think I have a fix here - it looks like some versions of opendkim use a different format for the signingtable file.

Try editing /etc/dkim-signingtable , and in the default line changing the * to % , then running service opendkim restart

Replying to this old thread, since I just ran now into this issue:

I had no success when editing dkim-signingtable as instructed just above, dkim stopped signing, so reverted my change.

But when doing this change * to % to default line only to the /etc/dkim-keytable and restarting opendkim as instructed, the wrong d=* became (right domain!). And dkim validation worked with a test with which didn't work with d=*.

Is that change of * to % in /etc/dkim-keytable correct ?

Has that been fixed in Virtualmin in the mean time ?

Should I edit that file on all my Virtualmin instances, or will next update auto-fix that ?

Virtualmin won't auto-update this in existing domains - you'd need to change it manually