OpenDKIM slows to a crawl outgoing mails at Postfix


Well-Known Member

Reaction score: 24
Messages: 321


The issue is like in the subject.
OpenDKIM signs mails and it takes too much time.

Example (50 MB mail size):
Without OpenDKIM: transmission time is around 5 sec.
With OpenDKIM: transmission time is around 120 sec.

I was looking at Postfix logs and the issue was by the OpenDKIM.
So, I've disabled the service and mails flow works like a charm.

CPU usage ca. 1%.

OS: FreeBSD 11.1p4 (bhyve)
Service: opendkim-2.10.3_7
Mail: postfix-3.2.3_1,1

LogWhy                  yes
Syslog                  yes
SyslogSuccess           yes
NameServers   ,

Canonicalization        relaxed/simple

KeyTable                /usr/local/etc/mail/KeyTable
SigningTable            /usr/local/etc/mail/SigningTable
SignatureAlgorithm      rsa-sha256

Socket                  inet:8891@localhost
DNSConnect              yes
DNSTimeout              5

ReportAddress           root
SendReports             yes

TemporaryDirectory      /var/db/opendkim/tmp
smtpd_milters = inet:, inet:
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

Thanks for any help.


New Member

Reaction score: 2
Messages: 2

In case you are still having this issue, I found the solution in the MaximumSignedBytes option in opendkim.conf
If you set it to 0 (zero) it will only sign the headers of the messages, which seems to be accepted by all destinations I have tried.
Other options include setting it to a few kilobytes, to sign the beginning of the message body but not the attachments.