• filter spamtrap
  • filter spf
  • filter dmarc
  • OpenSMTPD DMARC filter

    Verify DMARC on incoming mail.

    Changelog

    v0.3.0 - 2026-09-10
    v0.2.0 - 2026-09-01

    Build

    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

    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 }
    

    Syntax

    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)
    

    Mailing lists

    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

    Notes

    Code and repository

    Browse the source code here or clone the repository:

    $ git clone https://netsend.nl/opensmtpd-filter-dmarc.git