4

I want to setup automatic signing with DKIM for all outgoing emails. This ir virtual private server and hosts a single website. I have tried lots of tutorials on how to implement dkim email signing, but when i send email, anything related to dkim does not even show in syslog. Server is Ubuntu 14.04.

Postfix:

milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8892
non_smtpd_milters = inet:localhost:8892

opendkim.conf:

Syslog                  yes
LogWhy                  yes
LogResults              yes
Mode                    s
Domain                  *
KeyFile                 /etc/opendkim/email.key
Selector                email
Socket                  inet:8892@localhost

All that is showing when i start opendkim is

Jan 15 11:57:55 xxx opendkim[19947]: OpenDKIM Filter: mi_stop=1
Jan 15 11:57:55 xxx opendkim[19947]: OpenDKIM Filter v2.9.1 terminating with status 0, errno = 0
Jan 15 11:57:55 xxx opendkim[19999]: OpenDKIM Filter v2.9.1 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid)

This is what happens after postfix restart and mail sending:

Jan 15 15:55:52 example postfix/master[21899]: daemon started -- version 2.11.0, configuration /etc/postfix
Jan 15 15:55:54 example named[491]: client 82.146.43.2#14622 (example.ru): query (cache) 'example.ru/SOA/IN' denied
Jan 15 15:56:00 example opendkim[21598]: OpenDKIM Filter: mi_stop=1
Jan 15 15:56:00 example opendkim[21598]: OpenDKIM Filter v2.9.1 terminating with status 0, errno = 0
Jan 15 15:56:00 example opendkim: "X-Header" deprecated; use "SoftwareHeader" instead
Jan 15 15:56:00 example opendkim[21912]: OpenDKIM Filter v2.9.1 starting (args: -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid)

Jan 15 15:56:17 example postfix/pickup[21902]: 73C043C7C: uid=33 from=<[email protected]>
Jan 15 15:56:17 example postfix/cleanup[21922]: 73C043C7C: message-id=<[email protected]>
Jan 15 15:56:17 example postfix/qmgr[21903]: 73C043C7C: from=<[email protected]>, size=954, nrcpt=1 (queue active)
Jan 15 15:56:18 example postfix/smtp[21924]: 73C043C7C: to=<[email protected]>, relay=mail-tester.com[37.59.112.152]:25, delay=0.6, delays=0.02/0/0.44/0.13, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 0366B1241E58)
Jan 15 15:56:18 example postfix/qmgr[21903]: 73C043C7C: removed
7
  • What about your /etc/default/opendkim file, I believe you need the line SOCKET="inet:8892@localhost" there also (or maybe only).
    – NickW
    Jan 15, 2015 at 11:22
  • Hi, comment in the file states that "Command-line options specified here will override the contents of /etc/opendkim.conf". Anyway, i put there also, no changes. Jan 15, 2015 at 12:17
  • So, when you run netstat, can you see the opendkim port there in the list?
    – NickW
    Jan 15, 2015 at 12:19
  • Actually, no, i can see it in process list: opendkim 21598 0.0 0.0 225016 2392 ? Ssl 15:31 0:00 /usr/sbin/opendkim -x /etc/opendkim.conf -u opendkim -P /var/run/opendkim/opendkim.pid Jan 15, 2015 at 12:32
  • Yes now i see it in nestat also: tcp 0 0 localhost.localdom:8892 Jan 15, 2015 at 12:45

2 Answers 2

4

Fixed it. I don't know how but I had no_milters set in /etc/postfix/master.cf in "pickup" service. It prevents postfix to send email to milter.

1
  • That is odd, surprising the package doesn't add that during the install.
    – NickW
    Jan 15, 2015 at 14:32
0

I found cat /var/run/opendkim/opendkim.pid = 3091.

I inserted the line Socket inet:3091@localhost in opendkim.conf.

I added

smtpd_milters = inet:localhost:3091
non_smtpd_milters = inet:localhost:3091. 

And finally, opendkim is communicating with postfix.

I checked with netstat -apn | grep opendkim:

tcp        0      0 127.0.0.1:3091          0.0.0.0:*               LISTEN      593/opendkim
unix  3      [ ]         STREAM     CONNECTED     19033    593/opendkim
unix  3      [ ]         STREAM     CONNECTED     19034    593/opendkim
unix  3      [ ]         STREAM     CONNECTED     19036    593/opendkim
unix  3      [ ]         STREAM     CONNECTED     19035    593/opendkim
unix  2      [ ]         DGRAM                    18155    593/opendkim

Up and running!

3
  • 1
    That post is barely readable. The PID is likely to be different after the next reboot, so this doesn't seem a reliable solution.
    – RalfFriedl
    Sep 28, 2019 at 9:22
  • Ok, perhaps. But do you have other solution ? Sep 29, 2019 at 13:20
  • If we complete the socket in /etc/opendkim.conf and /etc/postfix/main.cf , isn't important for us the opendkim.pid . The opendkim.pid is the pid for service opendkim . This is mainly solution. Sep 29, 2019 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .