Mails are not signed with DKIM

My server is running Ubuntu 18 and I installed a fresh virtualmin on it. I then went on to enable DKIM but there was an error during installation. i fixed those and installed opendkim manually through SSH. Then I enabled outgoing signing and it worked fine. The problem is outgoing mails are not being signed with DKIM. In the /var/log/mail.log I have several lines of

warning: connect to Milter service inet:localhost:8891: Connection refused

I’ve searched for this error and there are many posts out there but for me they either didn’t work or I couldn’t understand them. Could someone help me figure out what the issue is here and how can we fix this?

Is port 8891 open?

Run netstat -tan.

Do you see a line that looks like:

tcp 0 0* LISTEN

No. I guess the port is not open then? Should I open the port or change something in virtualmin? I have not made any manual firewall changes. Its all been setup by virtualmin.

Yes, you’ll need to open the port. Either manually or thru Webmin - Networking - Linux Firewall. Doing it manually will show up in the GUI and vice versa. Whatever suits.

I’m not sure enabling DKIM opens the relevant ports automatically. It may do - but in your case having had an error may have prevented that (if that does happen).

You don’t have to open anything in your firewall as it only listens on localhost (ie.

First, you should check if opendkim service is running. if it isn’t then restart it and try again.

If it is, edit /etc/opendkim.conf. Change it to look like this:

#Socket local:/var/run/opendkim/opendkim.sock Socket inet:8891@localhost

Restart the opendkim service.

Oops - missed that it was the local loopback address ( My bad.

I did that but still no signature in the email and logs show the same error.

Try the suggestion as per,134.html

I’ve ended up in a new problem. I thought I’d disable DKIM signing and enable again to hopefully fix configuration issues. In Email Settings > DKIM, I turned Signing of outgoing emails to “No”. It worked. Then I tried to enable it again with option “Yes”. It wouldn’t turn back on. It doesn’t give any errors and says DKIM filter enabled but when I open the previous page again, the option is still set to “No”. Am I gonna have to do a fresh installation?

No solution. I reinstalled the server and its working fine now.