Verify DMARC on incoming mail.
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 }
usage: filter-dmarc [-v] [--spf-only-domains file]
--spf-only-domains file
envelope-sender domains for which DMARC must be skipped and only SPF
should be verified, one per line. Empty lines or lines starting with
a # will be ignored.
-v
increase verbosity (up to -vv)
Any domain can be exempted from DMARC verification, in that case only SPF is checked. Example allowing two mailing lists:
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 the SPF-only domains:
filter "dmarc" proc-exec "filter-dmarc --spf-only-domains /etc/mail/spf-only-domains" user _dmarc
Browse the source code here or clone the repository:
$ git clone https://netsend.nl/opensmtpd-filter-dmarc.git