问题原文
原帖链接 · 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
- Check the A-R headers:
Authentication-Results: host; dkim=failmeans the signature failed, butAuthentication-Results: host; dkim=permerrormight instead just mean the recipient was unable to grab your key. - 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
Are you sending invalid mail, and your mail system is fixing some problems for you, such as adding a missing
Dateheader? Fix/Replace non-compliant MUAs.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:
- overlong lines have been refolded
- Apply appropriate folding before sending - though using a
relaxesDKIM canonicalization can be sufficient.
- 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!
- 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--..)!
- you signed a header that is often legitimately modified by recipients
- Do not sign headers such as
ReceivedorX-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).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
