critical
Signing is enabled with a dkim-sign line for the receiver, while the key is chosen by the message itself. The node looks at the sending domain — taking it from the Sender header, or from From if there is none — and looks for a matching key among the domain-key declarations.
The search goes from top to bottom, and the first match wins. A declaration matches if its domain equals the sending domain or is its parent: a key for example.com will sign messages from mail.example.com; the reverse is not true.
Stream keys are stronger than general ones. If matching declarations exist both at the node level and inside a VirtualMTA, the ones inside win.
If none is found, the message leaves unsigned. Silently: no error, no log entry.
# exact domains higher, the asterisk last — otherwise it intercepts everything domain-key m, mail.port25.com, /etc/pmta/m.pem domain-key k1, example.org, /etc/pmta/k1.example.org.pem domain-key base, *, /etc/pmta/base.pem <domain *> dkim-sign yes </domain>
what people get wrong and how it ends3 mistakes▶
§ 3.3.1.55.1
§ 3.3.1.55.1
our experience
3 relations
domain-keyGlobalThe key selection rule in full — together with stream priority and the behavior when nothing matches. § 3.3.1.55.1Headers the sender uses to control deliveryChapter 10 describes what exactly the signing headers control. § 3.3.7.45A message header with which the submitting side adjusts the signatureOverrides the automatic key choice — but within the keys already declared. § 10.3.3A second signature on the same messageThe same mechanism a second time, with its own settings. § 10.3.4A signing key that came along with the messageThe key arrives with the message instead of sitting in the configuration. § 10.3.5A signature that preserves someone else's verification when forwardingThe same key declarations and the same selection rule, only a different set of signing lines. § 10.4.2
dig +short TXT k1._domainkey.example.org grep -i 'DKIM-Signature' /var/log/pmta/pmta.log | tail -5
3 articles
◇Do not send what will fail the check at the receiverThe node checks the SPF of its own mail before sending: if it fails, it bounces the message without waiting for someone else’s refusal.◇A message header with which the submitting side adjusts the signatureFive parameters in X-DKIM-Options: selector, domain, signing identity, query method and key list.◇A second signature on the same messageTwelve lines with the second- prefix: the message is signed twice, with different keys and under different identities.