大网数据广告活动
服务器运维问答

intermittent DKIM failure

· 52CE 我爱测

We have several email servers that send out legitmate email via PostFix and use openDKIM. Recently we've had some recievers claim the DKIM record can not be verified so we've tried various tools such as mail-tester.com, isnotspam…

问题原文

原帖链接 · dan360 · CC BY-SA 4.0

We have several email servers that send out legitmate email via PostFix and use openDKIM.

Recently we've had some recievers claim the DKIM record can not be verified so we've tried various tools such as mail-tester.com, isnotspam.com etc and see the same results, that some emails fail the DKIM check and others pass.

The same server can send one email with a DKIM pass, it can send another email and the DKIM fail. It seems to be the email itself that dictates whether the DKIM will pass or not. I can replicate this with the same emails everytime.

I can't understand this behaviour and wondered if anyone had seen a similar issue. How could the email itself cause a DKIM failure?

已采纳解答

原帖链接 · anx · CC BY-SA 4.0

First, rule out issues unrelated to the actual signature

  1. Check the A-R headers: Authentication-Results: host; dkim=fail means the signature failed, but Authentication-Results: host; dkim=permerror might instead just mean the recipient was unable to grab your key.
  2. Check the topmost Received: header not related the the recipient, if that is not you, you are looking at forwarded mail.

Then, determine who caused the signature to break

Grab a copy of the mail as it was submitted (e.g. stored in IMAP Sent folder), grab a copy of the raw mail as it was received, and compare byte by byte.

If the recipient cannot forward the full headers to you, you might be able to reproduce an issue by mailing it to your own box at the same provider, so you can look at the full headers.

a) You are modifying your own mail AFTER you are signing it, invalidating the signature

  1. Are you sending invalid mail, and your mail system is fixing some problems for you, such as adding a missing Date header? Fix/Replace non-compliant MUAs.

  2. Is some software you use for outgoing spam filtering modifying headers you are signing?

Ensure that the order of mail processing software places the signing last, after any such modification.

b) The recipient is modifying your mail BEFORE verifying your signature, therefore unable to verify your signature

Examples I have seen in the wild:

  1. overlong lines have been refolded
  • Apply appropriate folding before sending - though using a relaxes DKIM canonicalization can be sufficient.
  1. some software that does accept recipient addresses case insensitively (typically Microsoft) switched letter case of recipients to their canonical form
  • Updating your address books with the canonical (typically lowercase) spelling!
  1. the recipient mail server encoded Internationalized domain name (IDN) it received as UTF-8
  • This should be obvious because it will only happen with specific domains somewhere in the header. Send non-ASCII domains in idna encoding (xn--..)!
  1. you signed a header that is often legitimately modified by recipients
  • Do not sign headers such as Received or X-Spam-Status!

Note that if you mail server cannot apply the suggested transformation, you can still reject mail that you expect the fail - the sender can then try to use a different mail client or recipient address (or least notice something is wrong).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-10-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。