[ DKIM ]

Fix DKIM failures after a gateway adds a footer

Find the modifying hop and place signing after required footer insertion without weakening body coverage.

By the EmailAuth research team

[ Key points ]

  • A substantive footer added after full-body signing changes the hashed body.
  • Make required edits before the final authorized signing stage.
  • Check the new signing identity and alignment; adding a signature does not repair an old one.
On this page

A footer can turn a correctly signed outbound message into a DKIM failure. The repair starts with the processing sequence: identify which system signed the message, which system inserted the footer, and which signature the receiver evaluated. Publishing another DNS key cannot make a signature cover text added after it was created.

Prove which bytes changed

Save a controlled message immediately after signing and another after the gateway, using raw message export rather than copied text from a mail client. Preserve the original files. Record each signature's d, s, c, h and any l tag. A message may have multiple signatures with different coverage and outcomes.

DKIM computes a hash of the canonicalized body. Under ordinary full-body coverage, a new footer adds substantive content and changes that hash. Relaxed body canonicalization removes certain whitespace differences; it does not remove a disclaimer, HTML block or new MIME part. A body-hash mismatch concerns the compared body-hash inputs and values: the body representation, c/l settings and bh value. A damaged or incorrectly generated bh, or a signer/verifier implementation error, can also explain a mismatch. The comparison in RFC 6376 section 6.1.3 does not by itself prove that a gateway changed the body. A general signature failure may instead involve a signed header, key lookup or signature syntax. RFC 6376 §3.4, RFC 6376 §3.7 and RFC 6376 §6.1 describe those separate checks.

Compare the samples at the boundary where the footer is applied. Inspect both text/plain and text/html parts, MIME boundaries and transfer encoding. An apparently identical visible footer can be serialized differently. If the gateway also changes Subject, inspect whether Subject is listed in h: repairing the body alone will not restore a signature over a changed header.

Test the ordering rather than guessing

Illustrative scenario: an application creates an invoice, the outbound server signs it, and a gateway then appends a legal notice. The receiver reports a body-hash mismatch for the application's signature. In a controlled alternative, the gateway appends the notice first and an authorized signer signs the final serialized message. A passing result on that second path supports the ordering diagnosis. These are proposed test observations, not results from a real tenant.

Use the same message variants through both paths, including HTML, plain text and an attachment. Record receiver authentication results from a trusted boundary, the signature domain and the visible From domain. DKIM pass alone is insufficient for DMARC if the passing signature does not align with the author domain. An unrelated gateway signature can verify correctly without providing that aligned path.

Choose an owned signing boundary

The usual durable design is to perform required content changes before the final authorized signing operation. That may mean moving the signer later, moving footer insertion earlier, or configuring the gateway to sign the final message using a domain the organization controls. Confirm supported behavior and key ownership before selecting a design. Do not assume every gateway supports custom-domain signing.

If an existing signature is broken, adding a new valid signature does not repair the earlier one. Evaluate the new signature on its own merits and verify alignment separately. Do not enable the body-length l tag just to make footers disappear from the hash calculation: it leaves an unsigned suffix and creates the security trade-off described in RFC 6376 §8.2.

Finish with a regression check

Keep a route diagram showing the last body-changing component and the signer immediately after it. Re-test when disclaimer rules, antivirus rewriting or outbound routing change. Success means the required footer is present, the intended signature verifies, its domain meets the intended alignment policy, and critical messages still arrive through the expected route. Keep a rollback plan for the configuration change without treating removal of a required legal notice as an automatic remedy.

Use a regression acceptance record

For each synthetic plain-text, HTML and attachment variant, record: footer present; last body-changing hop; final signer d/s; selected c/h/l; trusted receiver result; Author Domain and alignment; and the business-route outcome. If the footer is missing, the notice requirement is not met even when DKIM passes. If the footer is present but only an unrelated gateway domain passes, the intended DKIM-alignment requirement is not met. These are acceptance criteria, not completed checks.

[ Takeaway ]

A substantive footer added after full-body signing changes the hashed body. Make required edits before the final authorized signing stage. Check the new signing identity and alignment; adding a signature does not repair an old one.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Capture the modifying boundary

Compare raw messages around the gateway and test each message format.

Next steps

  1. Inspect c, h and l.
  2. Verify the final signing domain.

CISO / SecOps

Avoid unsigned-content shortcuts

A passing prefix signature can conceal an unprotected suffix.

Next steps

  1. Review body coverage.
  2. Approve gateway key custody.

Founder / Non-technical

Keep required notices and delivery working

Approve a sequencing fix with the legal-notice owner rather than silently removing mandated content.

Next steps

  1. Name the notice owner.
  2. Include invoices in testing.

[ FAQs ]

Frequently asked questions

Does relaxed canonicalization tolerate a disclaimer?

No. It normalizes specified whitespace changes, not substantive footer text or new MIME parts.

RFC 6376 §3.4.4

Will another DNS key fix the body hash?

No. Key publication cannot make changed content match the original signed body.

RFC 6376 §6.1.3

Why does plain text pass while HTML fails?

The gateway may modify only the HTML part or serialize its MIME content differently. Compare raw samples of each variant.

Can a new gateway signature help?

Yes, if the gateway signs the final content correctly. For DMARC, its signing domain must also align with the visible From domain.

RFC 9989 §4.4.1

Should we remove the old signature?

Do not make removal the first diagnostic step. Preserve it in test evidence and assess the gateway product’s supported signature handling.

RFC 6376 §4.2

Is the l tag a safe shortcut?

It permits a body prefix to be signed while later content remains outside that coverage. Review that risk rather than adopting it as a general repair.

RFC 6376 §8.2

What if the body hash matches but DKIM fails?

Investigate selected headers, signature syntax, key retrieval and verification details instead of assuming the footer is responsible.

RFC 6376 §6.1

What proves the repair?

Controlled before-and-after raw messages, a passing intended signature at a trusted receiver, appropriate alignment and successful business-path tests.

[ Sources ]

Sources

  1. RFC 6376

    Sections §1 · §3.4 · §3.4.4 · §3.5 · §3.7 · §4.2 · §5.5 · §6.1 · §6.1.3 · §8.2

  2. RFC 9989

    Sections §4.4 · §4.4.1

  3. RFC 8601

    Sections §1.2

  4. RFC 2045

    Sections §1

  5. RFC 2046

    Sections §5.1.1

[ Glossary ]

Glossary

DKIM
A domain-associated signature over selected headers and body bytes.

RFC 6376 §1

Canonicalization
Defined preparation of message bytes before hashing.

RFC 6376 §3.4

DMARC alignment
The required relationship between an authenticated identifier and the Author Domain.

RFC 9989 §4.4

Body-length limit (l)
An optional count of canonicalized body octets included in the body hash.

RFC 6376 §3.5

MIME
Message formats representing structured parts and encodings.

RFC 2045 §1 RFC 2046 §5.1.1

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base