• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Opendkim fails to start CentOS 7 (Milter service inet:localhost:8891: Connection refused)

Liv

New Pleskian
I've got issues with OpenDKIM not starting on my CentOS 7 (with Postfix) server since an update for OpenDKIM crashed a while ago. It seems to have to do with this error:
Code:
postfix/smtpd[32230]: warning: connect to Milter service inet:localhost:8891: Connection refused

How do I check if the connection is working to this socket and how to fix it?

I've checked the following:
Code:
service opendkim start

Then it says:
Code:
Job for opendkim.service failed because the control process exited with error code. See "systemctl status opendkim.service" and "journalctl -xe" for details.

Then:
Code:
systemctl status opendkim.service

It says:
Code:
● opendkim.service - DomainKeys Identified Mail (DKIM) Milter
           Loaded: loaded (/usr/lib/systemd/system/opendkim.service; enabled; vendor preset: disabled)
           Active: failed (Result: exit-code) since Mon 2018-01-29 16:44:13 CET; 3min 40s ago
             Docs: man:opendkim(8)
                   man:opendkim.conf(5)
                   man:opendkim-genkey(8)
                   man:opendkim-genzone(8)
                   man:opendkim-testadsp(8)
                   man:opendkim-testkey
                   http://www.opendkim.org/docs.html
          Process: 14228 ExecStart=/usr/sbin/opendkim $OPTIONS (code=exited, status=127)
     
        systemd[1]: Starting DomainKeys Identified Mail (DKIM) Milter...
        systemd[1]: opendkim.service: control process exited, code=exited status=127
        systemd[1]: Failed to start DomainKeys Identified Mail (DKIM) Milter.
        systemd[1]: Unit opendkim.service entered failed state.
        systemd[1]: opendkim.service failed.

Then I've tried:
Code:
journalctl -xe

This and (/var/log/maillog) give the related error:
Code:
postfix/smtpd[32230]: warning: connect to Milter service inet:localhost:8891: Connection refused

This is the relevant part op the OpenDKIM config (/etc/opendkim.conf):
Code:
    ##  Create a socket through which your MTA can communicate.
    ## Socket       inet:8891@localhost
    Socket inet:[email protected]

This is the relevant OpenDKIM part from the Postfix config (/etc/postfix/main.cf):
Code:
    ## OpenDKIM config :)
    milter_default_action = accept
    milter_protocol = 2
    smtpd_milters = inet:localhost:8891
    non_smtpd_milters = inet:localhost:8891
This is the maillog for a test mail I sent( zgrep [email protected] /var/log/maillog* ):
Code:
    /var/log/maillog:Feb  4 11:28:51 vps2 postfix/smtpd[14598]: 134D5B6BE79: client=vps2.brandsomehosting.nl[::1], sasl_method=DIGEST-MD5, [email protected]
    /var/log/maillog:Feb  4 11:28:51 vps2 postfix/qmgr[31089]: 134D5B6BE79: from=<[email protected]>, size=1374, nrcpt=1 (queue active)

In Plesk I can see these modules are installed when I search for 'DKIM':
Code:
libopendkim 2.11.0-0.1.el6 (PLESK_17_5_3-thirdparty)
opendkim 2.10.3-3.el7 (epel)
perl-Mail-DKIM 0.39-8.el7 (base)

When I try to listen to everthing on localhost, the 8891 opendkim is not there (netstat -tulnp):
Code:
tcp        0      0 127.0.0.1:35018         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN      12308/master       
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      2612/dovecot       
tcp        0      0 127.0.0.1:34606         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN      8496/spamd child   
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      2612/dovecot       
tcp        0      0 127.0.0.1:33967         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:8880            0.0.0.0:*               LISTEN      22175/sw-cp-server: 
tcp        0      0 0.0.0.0:465             0.0.0.0:*               LISTEN      12308/master       
tcp        0      0 127.0.0.1:37268         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 149.210.236.168:53      0.0.0.0:*               LISTEN      1352/named         
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1352/named         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1058/sshd           
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      12308/master       
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1352/named         
tcp        0      0 127.0.0.1:12345         0.0.0.0:*               LISTEN      1122/magicspam-milt 
tcp        0      0 0.0.0.0:8443            0.0.0.0:*               LISTEN      22175/sw-cp-server: 
tcp        0      0 127.0.0.1:43645         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:42525         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN      2612/dovecot       
tcp        0      0 127.0.0.1:2911          0.0.0.0:*               LISTEN      1470/monit         
tcp        0      0 127.0.0.1:12768         0.0.0.0:*               LISTEN      2683/psa-pc-remote 
tcp        0      0 127.0.0.1:43040         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:2912          0.0.0.0:*               LISTEN      2044/sw-engine     
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      2612/dovecot       
tcp        0      0 127.0.0.1:34370         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      2612/dovecot       
tcp        0      0 0.0.0.0:8099            0.0.0.0:*               LISTEN      2752/plugin-ip     
tcp        0      0 127.0.0.1:33059         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:35688         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:36104         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:39529         0.0.0.0:*               LISTEN      2714/agent-service 
tcp        0      0 127.0.0.1:39465         0.0.0.0:*               LISTEN      2714/agent-service 
tcp6       0      0 :::3306                 :::*                    LISTEN      1298/mysqld         
tcp6       0      0 :::106                  :::*                    LISTEN      1080/xinetd         
tcp6       0      0 :::587                  :::*                    LISTEN      12308/master       
tcp6       0      0 :::110                  :::*                    LISTEN      2612/dovecot       
tcp6       0      0 ::1:783                 :::*                    LISTEN      8496/spamd child   
tcp6       0      0 :::143                  :::*                    LISTEN      2612/dovecot       
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::80                   :::*                    LISTEN      7374/httpd         
tcp6       0      0 :::8880                 :::*                    LISTEN      22175/sw-cp-server: 
tcp6       0      0 :::465                  :::*                    LISTEN      12308/master       
tcp6       0      0 :::53                   :::*                    LISTEN      1352/named         
tcp6       0      0 :::21                   :::*                    LISTEN      1080/xinetd         
tcp6       0      0 :::22                   :::*                    LISTEN      1058/sshd           
tcp6       0      0 :::25                   :::*                    LISTEN      12308/master       
tcp6       0      0 :::443                  :::*                    LISTEN      7374/httpd         
tcp6       0      0 :::8443                 :::*                    LISTEN      22175/sw-cp-server: 
tcp6       0      0 :::4190                 :::*                    LISTEN      2612/dovecot       
tcp6       0      0 :::993                  :::*                    LISTEN      2612/dovecot       
tcp6       0      0 :::995                  :::*                    LISTEN      2612/dovecot       
udp        0      0 0.0.0.0:2               0.0.0.0:*                           2752/plugin-ip     
udp        0      0 149.210.236.168:53      0.0.0.0:*                           1352/named         
udp        0      0 127.0.0.1:53            0.0.0.0:*                           1352/named         
udp        0      0 127.0.0.1:323           0.0.0.0:*                           681/chronyd         
udp        0      0 0.0.0.0:8000            0.0.0.0:*                           2752/plugin-ip     
udp6       0      0 :::53                   :::*                                1352/named         
udp6       0      0 ::1:323                 :::*                                681/chronyd
 
Last edited:
Don't know how to fix it, but after trying forever I just uninstalled opendkim altogether and re-installed it. That actually worked.. :)
 
Last edited:
Back
Top