Skip to content

opendkim: add AddCanonicalizedData option for RFC 9991 forensic reporting - #423

Merged
thegushi merged 2 commits into
trusteddomainproject:developfrom
thegushi:feat/rfc9991-canonicalized-data
Jul 21, 2026
Merged

opendkim: add AddCanonicalizedData option for RFC 9991 forensic reporting#423
thegushi merged 2 commits into
trusteddomainproject:developfrom
thegushi:feat/rfc9991-canonicalized-data

Conversation

@thegushi

Copy link
Copy Markdown
Collaborator

Summary

Adds an opt-in AddCanonicalizedData config directive (default off) that, for every verified signature, adds X-DKIM-Canonicalized-Header/X-DKIM-Canonicalized-Body milter headers containing base64-encoded canonicalized header/body bytes, tagged with the signature's d=/s= values.

This is a wiring task rather than new capture logic: the canonicalized bytes are already computed and captured in tmp files today for the unrelated SendReports feature (RFC 6591 signature-failure self-reports). AddCanonicalizedData exposes that same data unconditionally (pass or fail) via milter headers instead, using the existing dkim_sig_getreportinfo() and dkimf_base64_encode_file() as-is.

The motivating use case: a downstream DMARC filter (e.g. OpenDMARC) needs these bytes to populate the DKIM-Canonicalized-Header/-Body RFC 6591 ARF fields required by RFC 9991 forensic (ruf=) reports, but never verifies DKIM itself, so it has no canonicalized bytes of its own to report. Reading these headers back out and stripping them before final delivery is out of scope for this repo.

  • New AddCanonicalizedData boolean directive, documented in opendkim.conf.5.in / opendkim.conf.sample.
  • ORs in DKIM_LIBFLAGS_TMPFILES only (never KEEPFILES), same as SendReports.
  • Multi-signature messages get one header pair per signature, tagged d=...; s=...; so a consumer can match by domain/selector without needing a numeric index.
  • Reuses dkimf_base64_encode_file()'s existing fold style as-is; it already matches this codebase's own multi-line milter header convention.

Test plan

  • autoreconf -fi && ./configure --enable-lua && make check — all 174 libopendkim tests and all 33 opendkim/miltertest tests pass, including a new t-verify-canondata case that checks a passing signature gets both new headers with the exact expected tagged/folded base64 value.
  • Confirmed no new compiler warnings from the added code.

Dan Mahoney added 2 commits July 21, 2026 13:41
…ting

Adds an opt-in AddCanonicalizedData directive that emits
X-DKIM-Canonicalized-Header/-Body milter headers, tagged with the
signature's d=/s= values, for every verified signature. Reuses the
canonicalization tmp-file capture and base64 encoding already built for
the unrelated SendReports feature, so a downstream DMARC filter (e.g.
OpenDMARC) can populate the RFC 6591 ARF fields required by RFC 9991
forensic reports without verifying DKIM itself.
@thegushi
thegushi merged commit b1179c8 into trusteddomainproject:develop Jul 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant