[Rspamd] SPAMHAUS_DQS_KEY: generated "DBL" block replaces stock DBL rule — DBL URL/email checks lost, client IPs queried against DBL
Contribution guidelines
- I've read the contribution guidelines and wholeheartedly agree
Checklist prior issue creation
- I understand that failure to follow below instructions may cause this issue to be closed.
- I understand that vague, incomplete or inaccurate information may cause this issue to be closed.
- I understand that this form is intended solely for reporting software bugs and not for support-related inquiries.
- I understand that all responses are voluntary and community-driven, and do not constitute commercial support.
- I confirm that I have reviewed previous issues to ensure this matter has not already been addressed.
- I confirm that my environment meets all prerequisite requirements as specified in the official documentation.
Description
When SPAMHAUS_DQS_KEY is set, the Rspamd DBL rule is silently broken: the generated "DBL" block replaces Rspamd's stock DBL rule instead of merging into it. As a result, DBL is no longer checked against URLs, sender/Reply-To domains, DKIM, HELO or rDNS, and instead every inbound client IP is queried against DBL.
Root cause
data/Dockerfiles/rspamd/docker-entrypoint.sh writes this into /etc/rspamd/custom/dqs-rbl.conf:
"DBL" {
# override the defaults for DBL defined in modules.d/rbl.conf
rbl = "${SPAMHAUS_DQS_KEY}.dbl.dq.spamhaus.net";
disable_monitoring = true;
}The comment suggests the intent is to merge into the stock DBL rule and only change its zone, which is how Spamhaus's rspamd-dqs config is meant to be used from local.d. But data/conf/rspamd/local.d/rbl.conf includes the file with:
.include(try=true,override=true,priority=5) "$LOCAL_CONFDIR/custom/dqs-rbl.conf"With override=true, the two-line block replaces the stock rule entirely. The effective rule loses all of the stock checks (emails, dkim, helo, rdns, replyto, urls, content_urls), no_ip, ignore_defaults, the selectors and every DBL_* returncode, and falls back to rbl-module defaults, i.e. it queries the sending client IP against DBL.
Evidence
Effective config with a DQS key set (key masked):
$ docker compose exec -T rspamd-mailcow rspamadm configdump -j rbl | jq '.rbls.DBL'
{
"rbl": "<KEY>.dbl.dq.spamhaus.net",
"disable_monitoring": true
}The key and resolver work: dig dbltest.com.<KEY>.dbl.dq.spamhaus.net @172.22.1.254 returns 127.0.1.2. Scanning a message containing Spamhaus's permanent DBL test domain:
$ printf 'From: [email protected]\nTo: [email protected]\nSubject: dqs test\n\nhttp://dbltest.com/\n' \
| docker compose exec -T rspamd-mailcow rspamc -i 8.8.8.8 -F test@example.com -r [email protected] | grep DBL
Symbol: DBL (0.00)[8.8.8.8:from]- No
DBL_SPAMfor the listed URL. - The bare
DBLsymbol fires on the client IP. DBL answers IP queries with127.0.1.255("IP queries prohibited"), and because the replaced rule has no returncodes, any answer fires the parent symbol. This happens on every inbound message: it wastes DQS query quota and goes against Spamhaus's guidance that DBL must not be queried with IPs.
The other generated DQS rules don't cover the gap: spamhaus_dbl checks only HELO/rDNS/DKIM, SH_EMAIL_DBL only emails/Reply-To, and spamhaus_dbl_fullurls maps only the abused-legit codes (127.0.1.102–.106). A URL domain listed outright in DBL (127.0.1.2–.6) scores nothing when DQS is enabled. Without a key, the untouched stock rule against dbl.spamhaus.org does catch it. So enabling DQS silently removes plain DBL URL coverage.
Verified workaround
Put a full copy of the stock DBL rule from /etc/rspamd/modules.d/rbl.conf in data/conf/rspamd/custom/dqs-dbl-full.conf, changing only rbl to the DQS zone (plus disable_monitoring = true, matching the other DQS rules). Then include it in local.d/rbl.conf directly after the DQS include:
.include(try=true,override=true,priority=6) "$LOCAL_CONFDIR/custom/dqs-dbl-full.conf"It must be a higher priority. At the same priority=5, UCL keeps both same-named objects as an array and the rbl module rejects the rule (invalid config for DBL ... RBL is DISABLED), even though rspamadm configtest still reports syntax OK.
With the workaround in place:
$ docker compose exec -T rspamd-mailcow rspamadm configdump -j rbl | jq '.rbls.DBL | {rbl, checks, no_ip}'
{
"rbl": "<KEY>.dbl.dq.spamhaus.net",
"checks": ["emails", "dkim", "helo", "rdns", "replyto", "urls", "content_urls"],
"no_ip": true
}
$ (same dbltest.com test as above)
Symbol: DBL_SPAM (7.00)[dbltest.com:url]and DBL (0.00)[<ip>:from] no longer appears.
Suggested fix
Have the entrypoint emit the full DBL rule, with the stock checks, no_ip, ignore_defaults, selectors and returncodes, pointed at the DQS zone. The generated "ZRD" block is already written out in full with ignore_defaults = true, so this would follow the same pattern and keep the override=true include (needed to replace the other stock Spamhaus rules) working as intended.
Related
- The Rspamd DQS rules, including the
"DBL"block, were introduced in #5661 ("rspamd: Added DQS RBLs when key is set", "rspamd: fixed dqs rbl insertion handling"), so this has likely been present since 2024-08. - #5352 reported IP queries to
<KEY>.dbl.dq.spamhaus.netin 2023. That predates the Rspamd DQS rules and concerned Postscreen, and it was closed as stale. This issue is the Rspamd-side equivalent, with the root cause identified.
Steps to reproduce:
- Set
SPAMHAUS_DQS_KEYinmailcow.confto a valid DQS key and rundocker compose up -d. - Confirm the key works via mailcow's resolver:
docker compose exec acme-mailcow dig +short dbltest.com.<KEY>.dbl.dq.spamhaus.net @172.22.1.254→127.0.1.2 - Inspect the effective DBL rule:
docker compose exec -T rspamd-mailcow rspamadm configdump -j rbl | jq '.rbls.DBL'→ onlyrblanddisable_monitoring; nochecks,no_iporreturncodes. - Scan a message containing Spamhaus's DBL test domain in inbound mode:
printf 'From: [email protected]\nTo: [email protected]\nSubject: dqs test\n\nhttp://dbltest.com/\n' | docker compose exec -T rspamd-mailcow rspamc -i 8.8.8.8 -F [email protected] -r [email protected] - Expected:
DBL_SPAMondbltest.com:url. Actual: no DBL URL symbol; insteadDBL (0.00)[8.8.8.8:from], i.e. the client IP was queried against DBL. - For comparison, blank
SPAMHAUS_DQS_KEYand recreate: the stock rule againstdbl.spamhaus.orgis used and URL domains listed in DBL are detected again.
Logs:
### Before workaround (SPAMHAUS_DQS_KEY set, stock mailcow config) ###
### Key masked as <KEY>; recipient domain sanitized to example.org ###
$ docker compose exec -T rspamd-mailcow rspamadm configdump -j rbl 2>/dev/null | jq '.rbls.DBL'
{
"rbl": "<KEY>.dbl.dq.spamhaus.net",
"disable_monitoring": true
}
$ printf 'From: [email protected]\nTo: [email protected]\nSubject: dqs test\n\nhttp://dbltest.com/\n' \
| docker compose exec -T rspamd-mailcow rspamc -i 8.8.8.8 -F [email protected] -r [email protected] | grep -E '^Symbol'
Symbol: ARC_NA (0.00)
Symbol: ARC_SIGNED (0.00)[example.org:s=dkim:i=1]
Symbol: ASN (0.00)[asn:15169, ipnet:8.8.8.0/24, country:US]
Symbol: DBL (0.00)[8.8.8.8:from]
Symbol: DMARC_POLICY_REJECT (16.00)[example.com : No valid SPF, No valid DKIM, reject]
Symbol: FROM_EQ_ENVFROM (0.00)
Symbol: FROM_NO_DN (0.00)
Symbol: HFILTER_URL_ONLY (1.65)[0.75]
Symbol: MIME_GOOD (-0.10)[text/plain]
Symbol: MIME_TRACE (0.00)[0:+]
Symbol: MISSING_DATE (1.00)
Symbol: MISSING_MID (2.50)
Symbol: MISSING_XM_UA (0.00)
Symbol: MX_NULL (6.00)[example.com]
Symbol: ONCE_RECEIVED (0.10)
Symbol: RCPT_COUNT_ONE (0.00)[1]
Symbol: RCPT_MAILCOW_DOMAIN (0.00)[example.org]
Symbol: RCVD_COUNT_ZERO (0.00)[0]
Symbol: R_DKIM_NA (0.00)
Symbol: R_MISSING_CHARSET (0.50)
Symbol: R_SPF_FAIL (8.00)[-all:c]
Symbol: SH_HBL_EMAIL_FAIL (0.00)[[email protected]:server fail]
Symbol: SINGLE_SHORT_PART (0.00)
Symbol: TO_DN_NONE (0.00)
Symbol: TO_MATCH_ENVRCPT_ALL (0.00)
Symbol: VIOLATED_DIRECT_SPF (3.50)
-> No DBL_* symbol for the URL domain dbltest.com (listed in DBL, returns 127.0.1.2).
-> Bare "DBL" symbol fired on the client IP 8.8.8.8 (IP query sent to DBL).
-> SH_HBL_EMAIL_FAIL is expected on the free DQS tier (HBL is paid-only) and unrelated.
### After workaround (full stock DBL rule pointed at DQS zone, included at priority=6) ###
$ docker compose exec -T rspamd-mailcow rspamadm configdump -j rbl 2>/dev/null | jq '.rbls.DBL | {rbl, checks, no_ip, returncodes: (.returncodes | keys)}'
{
"rbl": "<KEY>.dbl.dq.spamhaus.net",
"checks": ["emails", "dkim", "helo", "rdns", "replyto", "urls", "content_urls"],
"no_ip": true,
"returncodes": ["DBL_ABUSE", "DBL_ABUSE_BOTNET", "DBL_ABUSE_MALWARE", "DBL_ABUSE_PHISH", "DBL_ABUSE_REDIR",
"DBL_BLOCKED", "DBL_BLOCKED_OPENRESOLVER", "DBL_BOTNET", "DBL_MALWARE", "DBL_PHISH",
"DBL_PROHIBIT", "DBL_SPAM"]
}
$ (same dbltest.com scan as above) | grep -E 'DBL|SPAMHAUS|_FAIL'
Symbol: DBL_SPAM (7.00)[dbltest.com:url]
Symbol: R_SPF_FAIL (8.00)[-all]
Symbol: SH_HBL_EMAIL_FAIL (0.00)[[email protected]:server fail]
-> DBL_SPAM now fires on the URL; the "DBL (0.00)[<ip>:from]" symbol no longer appears.
### Pitfall: workaround include at the same priority=5 as dqs-rbl.conf ###
### (UCL keeps both "DBL" objects as an array; "rspamadm configtest" still reports "syntax OK") ###
invalid config for DBL: {[path] = , [kind] = table_invalid, [details] = {[errors] = {[1] = {[path] = 1, [kind] = unknown_field, [details] = {[field] = 1}}, [2] = {[path] = 2, [kind] = unknown_field, [details] = {[field] = 2}}, [rbl] = {[path] = rbl, [kind] = required_field_missing, [details] = {[field] = rbl}}}}}, RBL is DISABLEDWhich branch are you using?
master (stable)
Which architecture are you using?
x86_64
Operating System:
Ubuntu 24.04.5 LTS
Server/VM specifications:
8GB / 4 vcpus / 60G disk
Is Apparmor, SELinux or similar active?
AppArmor enabled (Ubuntu 24.04 default profiles, 102 loaded), SELinux not installed
Virtualization technology:
KVM (Proxmox VE)
Docker version:
29.8.1 (Docker Engine - Community, client and server)
docker-compose version or docker compose version:
Docker Compose version v5.5.1
mailcow version:
2026-09
Reverse proxy:
None: mailcow's nginx is exposed directly (VM in a firewalled DMZ, no reverse proxy in front)
Logs of git diff:
Summary (full diff of unrelated files omitted; ssl-example contains a private key):
data/assets/ssl-example/cert.pem | 48 +++--- (auto-generated self-signed fallback cert)
data/assets/ssl-example/key.pem | 79 +++--- (auto-generated, not posted)
data/conf/postfix/main.cf | 39 +++ (regenerated from extra.cf: local SRS/alias-filter config, unrelated)
data/conf/postfix/master.cf | 18 +++ (local SRS re-injection listener, unrelated)
data/conf/rspamd/local.d/actions.conf | 2 +- (local reject threshold tuning, unrelated)
data/conf/rspamd/local.d/rbl.conf | 1 + (the workaround described in this issue, diff below)
diff --git a/data/conf/rspamd/local.d/rbl.conf b/data/conf/rspamd/local.d/rbl.conf
index 7f2976a0..e218e961 100644
--- a/data/conf/rspamd/local.d/rbl.conf
+++ b/data/conf/rspamd/local.d/rbl.conf
@@ -22,5 +22,6 @@ rbls {
}
.include(try=true,override=true,priority=5) "$LOCAL_CONFDIR/custom/dqs-rbl.conf"
+.include(try=true,override=true,priority=6) "$LOCAL_CONFDIR/custom/dqs-dbl-full.conf"
}
\ No newline at end of file
The "before" evidence in this issue was captured without this change; none of the other local changes touch Rspamd's RBL configuration.Logs of iptables -L -vn:
$ sudo iptables -L -vn
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
5919K 4896M MAILCOW 0 -- * * 0.0.0.0/0 0.0.0.0/0 /* mailcow */
6023K 4982M DOCKER-USER 0 -- * * 0.0.0.0/0 0.0.0.0/0
6023K 4982M DOCKER-FORWARD 0 -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (2 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:587
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:465
491 29388 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.253 tcp dpt:25
99092 5940K ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.11 tcp dpt:443
663 36008 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.11 tcp dpt:80
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:12345
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:4190
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:995
1282 76380 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:993
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:143
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.250 tcp dpt:110
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.6 tcp dpt:3306
0 0 ACCEPT 6 -- !br-mailcow br-mailcow 0.0.0.0/0 172.22.1.249 tcp dpt:6379
0 0 DROP 0 -- !docker0 docker0 0.0.0.0/0 0.0.0.0/0
0 0 DROP 0 -- !br-mailcow br-mailcow 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * docker0 0.0.0.0/0 0.0.0.0/0
119K 7157K DOCKER 0 -- * br-mailcow 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT 0 -- * docker0 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
3013K 479M ACCEPT 0 -- * br-mailcow 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
6023K 4982M DOCKER-CT 0 -- * * 0.0.0.0/0 0.0.0.0/0
2956K 4488M DOCKER-INTERNAL 0 -- * * 0.0.0.0/0 0.0.0.0/0
2956K 4488M DOCKER-BRIDGE 0 -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT 0 -- docker0 * 0.0.0.0/0 0.0.0.0/0
2786K 4410M ACCEPT 0 -- br-mailcow * 0.0.0.0/0 0.0.0.0/0
Chain DOCKER-INTERNAL (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP 6 -- !br-mailcow br-mailcow 0.0.0.0/0 0.0.0.0/0 /* mailcow isolation */Logs of ip6tables -L -vn:
$ sudo ip6tables -L -vn
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 MAILCOW 0 -- * * ::/0 ::/0 /* mailcow */
0 0 DOCKER-USER 0 -- * * ::/0 ::/0
0 0 DOCKER-FORWARD 0 -- * * ::/0 ::/0
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain DOCKER (0 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-BRIDGE (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-CT (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-FORWARD (1 references)
pkts bytes target prot opt in out source destination
0 0 DOCKER-CT 0 -- * * ::/0 ::/0
0 0 DOCKER-INTERNAL 0 -- * * ::/0 ::/0
0 0 DOCKER-BRIDGE 0 -- * * ::/0 ::/0
Chain DOCKER-INTERNAL (1 references)
pkts bytes target prot opt in out source destination
Chain DOCKER-USER (1 references)
pkts bytes target prot opt in out source destination
Chain MAILCOW (1 references)
pkts bytes target prot opt in out source destinationLogs of iptables -L -vn -t nat:
$ sudo iptables -L -vn -t nat
Chain PREROUTING (policy ACCEPT 588K packets, 47M bytes)
pkts bytes target prot opt in out source destination
126K 7564K DOCKER 0 -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1443 packets, 103K bytes)
pkts bytes target prot opt in out source destination
0 0 DOCKER 0 -- * * 0.0.0.0/0 !127.0.0.0/8 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT 123K packets, 7370K bytes)
pkts bytes target prot opt in out source destination
573K 46M MASQUERADE 0 -- * !br-mailcow 172.22.1.0/24 0.0.0.0/0
0 0 MASQUERADE 0 -- * !docker0 172.17.0.0/16 0.0.0.0/0
Chain DOCKER (2 references)
pkts bytes target prot opt in out source destination
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:7654 to:172.22.1.249:6379
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:13306 to:172.22.1.6:3306
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:110 to:172.22.1.250:110
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 to:172.22.1.250:143
1283 76440 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 to:172.22.1.250:993
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:995 to:172.22.1.250:995
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 0.0.0.0/0 tcp dpt:4190 to:172.22.1.250:4190
0 0 DNAT 6 -- !br-mailcow * 0.0.0.0/0 127.0.0.1 tcp dpt:19991 to:172.22.1.250:12345
665 36108 DNAT 6 -- !br-mailcow *Source: mailcow/mailcow-dockerized