Verify DMARC on incoming mail. Any sender can be allowed to skip DMARC and only pass based on SPF (this can be used with mailing lists).
Rust >= 1.88.0 is required (2024 edition).
git clone https://netsend.nl/opensmtpd-filter-dmarc.git
cd opensmtpd-filter-dmarc
cargo build --release
install -m555 -gbin target/release/opensmtpd-filter-dmarc /usr/local/libexec/smtpd/filter-dmarc
useradd -d /var/empty -s /sbin/nologin _dmarc
smtpd.conf:
filter "dmarc" proc-exec "filter-dmarc" user _dmarc
listen on egress filter { dmarc }
Mailing lists can be allowed by the mailing list's envelope-sender domain if they pass SPF. Example:
echo openbsd.org > /etc/mail/spf-only-domains
echo lists.openwall.com >> /etc/mail/spf-only-domains
Configure your smtpd.conf to start the filter with filter "dmarc"
proc-exec "filter-dmarc --spf-only-domains /etc/mail/spf-only-domains" user
_dmarc.
Once everything is set, restart smtpd.
usage: filter-dmarc [-v] [--spf-only-domains file]
--spf-only-domains file
envelope-sender domains for which DMARC must be skipped and pure
SPF should run, one per line. Empty lines or lines starting with
a # will be ignored.
-v
increase verbosity (up to -vv)
Browse the source code here or clone the repository:
$ git clone https://netsend.nl/opensmtpd-filter-dmarc.git