]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] mx_check: IP-class classification, trust maps, run-scope toggles 6039/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 21 May 2026 09:43:00 +0000 (10:43 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 21 May 2026 09:43:00 +0000 (10:43 +0100)
commit0eb4c443e1eab333698a4b466973594eda393fb8
tree714b977460b4d0abcb9fa5fc247d91b92eaa33c5
parent37027b0eefbd730eb39e5b49bc399800f3bb1659
[Feature] mx_check: IP-class classification, trust maps, run-scope toggles

Phase C of #6032 (IPv6 probing deferred):

IP-class classification. Resolved MX-target IPs are partitioned into
PUBLIC / LOCAL / BOGON against fixed RFC range sets. LOCAL (RFC1918,
CGNAT, ULA) is unprobeable from our vantage point; BOGON (loopback,
link-local, TEST-NET, multicast, reserved) has no legitimate meaning as
an MX target and is a packet-injection footgun. Only PUBLIC addresses
are probed; the rest emit MX_LOCAL_ONLY/MIX and MX_BOGON_ONLY/MIX. The
range sets are a correctness invariant and are not operator-tunable.

Per-layer trust/skip maps. exclude_mxs is a glob map of trusted MX
hostnames; a hit short-circuits the whole check with MX_WHITE. exclude_ips
is a radix map of IPs dropped from the probe set; if it empties the set,
MX_SKIP fires.

Run-scope toggles. check_authorized and check_local (both default false)
control whether authenticated and local-network senders are checked,
replacing the previous hardcoded skip.

test_mode (testing only) lifts loopback out of the bogon set so the probe
path stays exercisable against a local listener; functional tests use it.

The IPv4-mapped range ::ffff:0:0/96 is intentionally excluded from the
bogon set: rspamd's radix stores IPv4 as its v4-mapped form, so listing
that prefix would classify all IPv4 traffic as bogon.

Refs #6032.
conf/modules.d/mx_check.conf
src/plugins/lua/mx_check.lua
test/functional/cases/167_mx_check.robot
test/functional/configs/mx_check-dns.conf
test/functional/configs/mx_check.conf