Can’t get opendkim to work on Ubuntu

I just set up my first mail server on Ubuntu 12.04 LEMP server with Postfix and Dovecot using this guide, and it may have been the happiest day of my life to send an email to my Gmail account. The only problem was that the email ended up in the Gmail spam folder, so I went to work setting up SPF and DKIM. SPF is fine, but DKIM isn’t working.

I installed opendkim, and followed the guide in this Ubuntu Community Help page. However, I did not install opendkim-tools as it caused a conflict and it seems opendkim has all of the necessary packages.

The problem is that the headers do not appear in sent emails. I have tried both the loopback port (SOCKET="inet:8891@localhost") and the unix domain socket (SOCKET="local:/var/run/opendkim/opendkim.sock") and neither option gets headers in the emails.

I have set up my firewall using ufw and allowing the apps that I have installed. In /etc/ufw/before.rules it has the default settings for loopback:

# allow all on loopback
-A ufw-before-input -i lo -j ACCEPT
-A ufw-before-output -o lo -j ACCEPT

But I don’t see these rules when I run iptables -L.

Even though I have a very limited understanding of these things, I feel my preference would be to have it set up for Unix domain sockets anyhow, but getting DKIM working through any method would be great.

(On a side note, it would be nice if there were a tag for opendkim – serverfault informed me it doesn’t exist and I must have a score of 300 to create a new tag.)

Answer

I was able to resolve the issue by installing opendkim and opendkim-tools using precise-backports. Opendkim in Precise is broken.

aptitude install opendkim/ubuntu-backports
aptitude install opendkim-tools/ubuntu-backports

DKIM now works properly with TCP ports. I will update the Ubuntu Community Guide page this evening.

Attribution
Source : Link , Question Author : Paul , Answer Author : Paul

Leave a Comment