Topic: Gibberish for dkim signature in mail headers
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.0
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: Ubuntu 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
I've had an iRedMail server since 2016. Lately I've been plagued by bad deliverability so I went on to investigate. It turns out the message headers contain something completely different from my dkim keys.
• I get a pass for all domains (except for one, which is currently inactive) on amavisd-new testkeys
• amavisd-new showkeys shows correct keys consistent with DNS records (truncated in the middle):
; key#2 2048 bits, i=dkim, d=domain.com, /var/lib/dkim/domain.com.pem
dkim._domainkey.domain.com. 3600 TXT (
"v=DKIM1; p="
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyA7VGqqsfoyaIXDXYSAi"
...
...
...
...
"TrvVOeuhdbTgF7HwRTwPTkQP7S2caXdqAIUwdIKw5lJ85HqLWSqPmXHtrLnHFygl"
"BQIDAQAB")
• dig -t txt dkim._domainkey.domain.com produces:
; <<>> DiG 9.11.3-1ubuntu1.17-Ubuntu <<>> -t txt dkim._domainkey.domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18111
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;dkim._domainkey.domain.com. IN TXT
;; ANSWER SECTION:
dkim._domainkey.domain.com. 3600 IN TXT "v=DKIM1;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyA7VGqqsfoyaIXDXYSAi (...) TrvVOeuhdbTgF7HwRTwPTkQP7S2caXdqAIUwdIKw5lJ85HqLWSqPmXHtrLnHFyglBQIDAQAB;t=s;"
• Mail headers look completely different (quoted at full length):
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=domain.com; h=
content-transfer-encoding:content-type:content-type:subject
:subject:from:from:to:content-language:user-agent:mime-version
:date:date:message-id; s=dkim; t=1651325590; x=1652189591; bh=kv
/9lHvEANTbGkhklt21W0+65fXdhCyxjMUryoxl2jw=; b=UmQrnKpUv2ZeXZcX85
njBYOV0TGMTKdcWcMn8DyK9W7BoEUSDKf0c5p3IDDXwLZ0KcB1eoo8O0t9JnzVc3
IaQyvQPFys7O0GPf3TpSZz2w9LkBecJmhawIznqeDXqN2D0p4I70vTWhE93Awsws
pM9+6gxivrRumfQNZsnUH4VEERcA5CQZndSAKytdC/vWrmqPSX9JpOt8fwm/w6/L
qveLYbgVwvkLYiqsOBXKPdtpN6Dpq3K/eSJY8D0XJwBD4bhTKY+F7RsDY/YLxU8A
0Q7Sw8N+37RpDnY/Po5GIbkOBFi2/CLyp7u/ly0+J5aW03JuqTtXRyb9j+FarfZg
8o6g==
• A week ago it was yet different:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=domain.com; h=
content-transfer-encoding:content-type:content-type:subject
:subject:from:from:to:content-language:user-agent:mime-version
:date:date:message-id; s=dkim; t=1640155099; x=1641019100; bh=Hw
Myja6rrGK2Ox0+v6o2UuhQExd7DMW8m0ZG4H1mkzw=; b=QsB5x1PlL/j7AXHHG4
xcAoVf61dpE5DJk1loZ4mIAytZqATbhaQAhmKTOJAUi9Dl6nHnoy35Z0BLWRUv3a
RIbZXE30J27Q1+lBE+am6mUnfKJCwuCLGa+775UrF4GnS6khcePOr88iZYCMoko5
tmCNr+tAQxQ7gfr2N2wgaYTAXaraY378oUl0NeslCe8KGxh6seZKfyC9W7rMyJV/
WPFc8qZya+KtGsm7rsV7wvQlqwVW02EoSE/kSnZGlGM4CVVqgX2iTTpEyjmtGHVx
5UnxJkg15fQcJAMJL0DSTdkCLJCsPCXAYQJZbYJ+xa+aOJY8lLnpHTdseKXEtUKq
Z3cQ==
• I have reviewed emails from 2016 to 2022. It seems I never had correct dkim keys in messages. Ive been given 'just generated, assumed good' at best.
Is there a way to get it working?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.