Getting error: Milter (opendkim): error connecting to filter: Connection refused by localhost

December 18, 2016 4.2k views

I’ve Ubuntu 16.04
I’m trying to config DKIM for sendmail.
Getting this error when email is sending:
sm-mta[19671]: uBILBoWg019671: Milter (opendkim): error connecting to filter: Connection refused by localhost

I’ve added port 12301 to firewall.
Also in /etc/opendkim.conf I’ve added:
Socket inet:12301@localhost

And also in /etc/default/opendkim:

And in /etc/mail/ at the end:
INPUTMAILFILTER(‘opendkim’, ’S=inet:12301@localhost’)

Any help?

1 Answer

Is it running?

  • How can I check?

    • ps faux | grep -i dkim
      • yes

        opendkim 18324  0.0  0.4 221588  2456 ?        Ssl  20:14   0:00 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/ -p local:/var/run/opendkim/opendkim.sock
        • Is it listening to port 12301 (lsof -i :12301 -n) and did you recompile your sendmail config?

          • strange but nothing is listening 12301

            by recompile you mean this:

            m4 /etc/mail/ > /etc/mail/


  • I see this

    systemctl status opendkim.service
    ● opendkim.service - DomainKeys Identified Mail (DKIM) Milter
       Loaded: loaded (/lib/systemd/system/opendkim.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Sun 2016-12-18 21:50:29 UTC; 16s ago
         Docs: man:opendkim(8)
      Process: 20153 ExecStart=/usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/ -p $SOCKET $DAEMON_OPTS (c
      Process: 20146 ExecStartPre=/bin/chown opendkim.opendkim /var/run/opendkim (code=exited, status=0/SUCCESS)
      Process: 20141 ExecStartPre=/bin/mkdir -p /var/run/opendkim (code=exited, status=0/SUCCESS)
     Main PID: 18324 (code=exited, status=0/SUCCESS)
Have another answer? Share your knowledge.