Skip to content

Add external report destination verification via _report._dmarc DNS lookup (openSUSE z03)#392

Merged
thegushi merged 1 commit into
trusteddomainproject:developfrom
stoecker:z03_reportDestVerificationV2.patch
May 29, 2026
Merged

Add external report destination verification via _report._dmarc DNS lookup (openSUSE z03)#392
thegushi merged 1 commit into
trusteddomainproject:developfrom
stoecker:z03_reportDestVerificationV2.patch

Conversation

@stoecker
Copy link
Copy Markdown

reportDestVerificationV2.patch
written by Juri Haberland
status: recommended - enhancement
This patch is not yet linked to an OpenDMARC ticket, as I want to receive some feedback from others. It adds external report destination verification and report address replacement. It also reorganizes the way the reports are sent. In addition it sends an error report if all report addresses are unusable due to size limitations. See #159

@thegushi thegushi changed the base branch from master to develop May 29, 2026 19:58
@thegushi thegushi changed the title Patches used in openSUSE: z03_reportDestVerificationV2.patch Add external report destination verification via _report._dmarc DNS lookup (openSUSE z03) May 29, 2026
@thegushi thegushi closed this May 29, 2026
@thegushi thegushi reopened this May 29, 2026
Implements RFC 9990 §4 / RFC 9991 §5 external report destination
verification in opendmarc-reports, closing the gap identified in issue
trusteddomainproject#371 (the existing verification in libopendmarc covers only the milter
path, not the reporting script).

Key changes:
- For each cross-domain RUA mailto: address, query
  <from-domain>._report._dmarc.<dest-domain> for a TXT record starting
  with 'v=DMARC1'. Falls back to the wildcard (*._report._dmarc.<dest>)
  on NXDOMAIN. Fails open on SERVFAIL or timeout (conservative: don't
  drop reports due to transient DNS failures). Same-org addresses are
  accepted without a DNS query.
- Org-domain comparison uses a built-in PSL reader (load_psl /
  get_org_domain) that reads the same public_suffix_list.dat file the
  milter uses, with a two-label fallback when no PSL is configured.
  Replaces the Domain::PublicSuffix CPAN dependency in the submitted
  patch -- PSL consumption is string parsing, not a library problem.
- Size-limit suffix (!NNNk/m/g/t) parsed from RUA URIs (check_size_restriction).
  Addresses that exceed their declared size limit receive a
  delivery-failure notice instead of the full report.
- http/https URIs bypass destination verification (external auth applies
  only to mailto:) and are handled inline.
- parse_rua_uri() consolidates URI parsing and scheme validation.
- More unique MIME boundary (hostfqdn()/time() vs static 'report_section').

Written by Juri Haberland for openSUSE (z03_reportDestVerificationV2.patch),
submitted by Dirk Stoecker. Substantially reworked for current develop:
conflict resolution, Domain::PublicSuffix replaced with built-in PSL
reader, Switch module removed, dead code eliminated, date format fixed.

Co-authored-by: Juri Haberland <juri@koschikode.com>
Co-authored-by: Dirk Stöcker <github@dstoecker.de>
@thegushi thegushi force-pushed the z03_reportDestVerificationV2.patch branch from e2dd611 to 2120b22 Compare May 29, 2026 21:33
@thegushi thegushi merged commit 8279bd3 into trusteddomainproject:develop May 29, 2026
1 check failed
thegushi added a commit to thegushi/OpenDMARC that referenced this pull request May 29, 2026
thegushi added a commit that referenced this pull request May 30, 2026
…ent (#393)

* docs: update CHANGES with attribution for merged and closed PRs

- Add attribution to policy_published.domain fix (#270): independently
  patched by Eneas U. de Queiroz for openSUSE, submitted by Dirk Stöcker
- Add attribution to opendmarc_tld_read_file memory leak fix (#347):
  independently patched by Juri Haberland for openSUSE, submitted by
  Dirk Stöcker
- Add attribution to domain case normalization fix (#351): independently
  patched by Dirk Stöcker for openSUSE
- Document failure report Subject line fix (#391): written by Juri
  Haberland, submitted by Dirk Stöcker
- Document failure report hostname in body (#389): written by Juri
  Haberland, submitted by Dirk Stöcker
- Document IgnoreAuthenticatedClients logging (#387): written by Juri
  Haberland, submitted by Dirk Stöcker
- Document --skipdomains option (#383): written by Dirk Stöcker

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add CHANGES entry for PR #388 (RFC 2822 date format in report body)

* docs: add CHANGES entries for PRs #390 (UTC timezone, migration script)

* docs: add CHANGES entry for PR #380 (Content-Description MIME headers)

* ci: add libnet-dns-perl; docs: add CHANGES entry for PR #392

* reports: rewrite opendmarc-importstats as a Perl script

Converts the 25-line shell script to a proper Perl .in template,
consistent with every other script in reports/.

- Reads HistoryFile from opendmarc.conf using a real parser (no
  grep/sed), so users who configure a non-default path get correct
  behaviour automatically
- --history-file=path overrides the config for command-line flexibility
- --conf=file selects an alternate opendmarc.conf
- Falls back to /var/run/opendmarc.dat when HistoryFile is not set
- Uses open(pipe) instead of shell redirection to avoid injection risk
- --verbose and --version consistent with other reporting tools

Closes #358.

* docs: add CHANGES entry for importstats rewrite; ci: add to syntax check

* feat: add IgnoreMailTo option to suppress history recording by recipient

Adds a comma-separated IgnoreMailTo config option analogous to
IgnoreMailFrom.  Messages addressed to any listed address are not
written to the history file and generate no aggregate reports.  The
primary use case is loop prevention: a domain whose rua=/ruf= address
also receives mail through the filter can suppress report traffic from
being treated as reportable.

Original patch by Dirk Stöcker (openSUSE ticket208 / PR #381).
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.

2 participants