# OpenDKIM slows to a crawl outgoing mails at Postfix



## IPTRACE (Jan 2, 2018)

Hello!

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

opendkim.conf

```
LogWhy                  yes
Syslog                  yes
SyslogSuccess           yes
NameServers             8.8.8.8, 8.8.4.4

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
```
main.cf

```
smtpd_milters = inet:127.0.0.1:8891, inet:127.0.0.1:8893
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
```

Thanks for any help.


----------



## tobia (Jun 26, 2020)

Hello
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.


----------

