Hello @anunnaki , that article was written by me.
Seeing your issue, I feel that opendkim-default-keygen is very generalized step which works on most of the systems but tends to mess sometimes as that command tries to create the DKIM keys for the Linux’s hostname only. That step also does not works for the users who want to sign DKIM keys for more than one domain on the same VPS.
It might gave that error, because you didn’t had your hostname correctly configured in Linux.
Anyways, I will revise that article shortly. Right now, I’m posting here the steps required to do from your side as of now :
You will need to generate the keys using these commands for your specific domain(s) by the following commands.
“mkdir /etc/opendkim/keys/example.com” (A directory in which the keys will reside)
“/usr/sbin/opendkim-genkey -D /etc/opendkim/keys/example.com/ -d yourdomain.com -s default” (generating keys for your specific domain and not the default hostname).
Then the permissions stuff by the following commands so OpenDKIM doesn’t have any issues reading the keys :-
“chown -R root:opendkim /etc/opendkim/keys/yourdomain.com”
“chmod 640 /etc/opendkim/keys/yourdomain.com/default.private”
“chmod 644 /etc/opendkim/keys/yourdomain.com/default.txt”
And after that, same steps for SigningHosts and other config files with yourdomain.com and it’s folder in the config files respectively.
The steps after this should work the same way and this method can also be used to let the OpenDKIM work for more than one e-mail Domains on the same Server.
Hope it works for you now or you got the idea how it works. :
Post here any problems if you face after this.