Your team is adding DKIM signing to a self-hosted MTA for transactional mail; how do you decide which header fields go in h= and which to over-sign?
answer
- one field is not optional
- what the reader sees and acts on
- what relays legitimately add or change
- the paths this mail actually takes
basics
~20 sSign From (mandatory) and every field a reader sees or acts on, such as Subject, Date, To, Reply-To and MIME fields; omit fields relays add or change, like Received and Return-Path; over-sign fields nothing on your paths adds.
solid answer
~50 sStart from RFC 6376's rules: `From` MUST be signed, and signers SHOULD NOT sign fields likely to be legitimately modified or removed in transit, with `Return-Path` and `Received` the standard examples. Then decide what a passing signature should vouch for. For receipts and password resets, which rarely pass through lists, sign broadly: `Subject`, `Date`, `To`, `Cc`, `Reply-To`, `Sender`, `Message-ID` and the MIME fields, since an unsigned visible field lets a validly signed copy carry different text and some verifiers distrust signatures that skip MIME fields. Over-sign the fields a reader relies on so an added copy breaks the signature, and list `Reply-To` even when absent if you never use it. If any stream carries one-click unsubscribe, RFC 8058 requires `List-Unsubscribe` and `List-Unsubscribe-Post` in `h=`. Write the policy down, apply it per stream and watch failure rates after changes.
go deeper
Recall that From must be signed and that fields relays add, such as Received, are left out of h=.
Explain the RFC 6376 rules for choosing fields, which fields it calls highly advised, and what over-signing a field means in h=.
Map each field to the paths your mail takes and show which choices break signatures on lists or gateways, with the evidence you would read to confirm it.
Own the header list as a policy: weigh coverage against fragility per stream, assign who reviews changes, and decide how breakage is detected after a new sending path appears.
## The fixed points from RFC 6376 A header-signing policy is a judgment call, but it sits inside a few rules from RFC 6376 (September 2011), Section 5.4: - **`From` MUST be signed.** A verifier ignores a signature whose `h=` lacks it. - Signers **SHOULD NOT** sign an existing field likely to be legitimately modified or removed in transit; RFC 5321 explicitly permits changing or removing `Return-Path`. - Signers **MAY** sign any other field present, and MAY list fields that are absent to assert they were not there. - The RFC's informative note calls signing `Date`, `Subject`, `Reply-To`, `Sender` and all MIME fields "highly advised", and warns that verifiers may treat unsigned fields with extreme skepticism, or ignore a signature that does not cover certain fields. Section 6.1.1 confirms the last point from the receiving side: a verifier MAY return PERMFAIL (unacceptable signature header) when a signature leaves out fields it considers essential, and the RFC names unsigned MIME fields as the case in point. ## Three strategies the RFC names RFC 6376 describes three ways signers choose, without picking one: | Strategy | What goes in h= | Strength | Weakness | |---|---|---|---| | Sign all existing non-repeatable fields | Nearly everything except trace fields | Maximum coverage | Breaks when an intermediary adds or edits any of them | | Sign what is displayed or affects processing | `From`, `Subject`, `Date`, addressing, MIME | Covers what a reader trusts | Needs a judgment for each new field | | Sign only well-known fields | A fixed list | Predictable | Misses fields the organisation later relies on | Most teams end up with the second strategy written down as an explicit list. ## Weighing coverage against fragility The tension is simple: every field you sign is a field nobody can change without breaking the signature. Arguments for signing more: - An unsigned `Subject` lets a validly signed message be resent with different visible text and still verify; RFC 6376's implementer's note recommends signing all end-user visible fields for exactly this reason. - Unsigned MIME fields such as `Content-Type` let the rendering of a signed body change. - `Message-ID` is worth signing if the organisation wants separate instances of a message to be distinguishable. Arguments for signing less: - `Received` and `Return-Path` change on every path, and RFC 6376 lists `Received`, `Comments` and `Keywords` among fields to exclude. - Fields that legitimately occur several times can be reordered or added to in transit. - Mail that passes through discussion lists or gateways that rewrite `Subject` or add their own `Reply-To` will break more often the more you sign; for those flows a broken signature is likely anyway, which is a canonicalization and forwarding question rather than a header-list one. For transactional mail, which typically goes straight from your MTA to the recipient's provider, the fragility cost is low and the case for broad signing is strong. ## Deciding what to over-sign Over-signing means listing a name once more than it occurs, so an added copy changes the hash. A workable rule: 1. Over-sign fields a reader relies on: `From`, `Subject`, `Date`, `To`, `Cc`, `Reply-To`, `Sender`. 2. Over-sign MIME fields that control rendering, such as `Content-Type`, where your mail never gains a second one. 3. List absent fields you never use, such as `Reply-To` on a stream without one, to assert their absence. 4. Never over-sign trace fields or anything a normal hop adds. ## Streams with different needs One MTA often carries several streams. A policy per stream avoids one rule breaking another: - **Receipts and resets**: broad signing, over-sign the visible fields. - **Bulk mail with one-click unsubscribe**: RFC 8058 (January 2017) says `List-Unsubscribe` and `List-Unsubscribe-Post` MUST be covered by a valid DKIM signature and named in `h=`, and that receivers SHOULD NOT offer one-click unsubscribe without it. - **Mail relayed for internal systems**: check which fields those systems add after your signer, and keep them out of `h=`. ## Owning the decision The header list is a promise to every receiver about what a passing signature means, so treat it as a reviewed configuration: - Record the list per stream, with the reason for each field. - Test it by sending to mailboxes you control and reading the receiver's `Authentication-Results`. - After any change, watch DKIM failure rates in the domain's aggregate reports, which are covered with DMARC reporting. - Revisit the list when a new intermediary, gateway or sending path is added, since that is when a signed field starts being rewritten.
- Should the DKIM signer sign Authentication-Results headers already present on the message?RFC 6376 mentions security-related fields such as `Authentication-Results` as possibly of interest, but signing fields that may occur several times and be added in transit is fragile. For outbound transactional mail the receiver writes its own `Authentication-Results`, so there is rarely a reason to sign one.
- A mailing list re-sends your messages with a rewritten Subject. Should you stop signing Subject?Usually not. Dropping `Subject` weakens every message to protect one path where other changes, such as an added footer, often break the signature anyway. Keep it signed and treat list traffic as an indirect-flow problem that receivers and the list operator handle.
- Why keep a separate h= policy for each mail stream instead of one global list?Streams take different paths and carry different fields. Bulk mail needs `List-Unsubscribe` and `List-Unsubscribe-Post` signed under RFC 8058, receipts need broad coverage, and mail from internal systems may gain fields after signing. One global list either misses a requirement or breaks a stream.
- Signing Received makes the signature stronger against tampering.
- Only From matters, so h=from alone is a sound policy.
- Signing Return-Path proves the envelope sender is genuine.
- Sign every header field present to be safe.
- Unsigned MIME fields carry no risk because bh= covers the body.