castris
Verified User
DirectAdmin version: 1.696
rspamd: via CustomBuild (spamd=rspamd)
Affected template: /usr/local/directadmin/data/templates/rspamd_settings.conf
The
1. Priority bug: whitelist blocks use
2. Missing apply.actions: Even if the priority were correct, whitelist blocks only have
Note: The
You can confirm which settings block rspamd selected in the log:
It will always show
The whitelist blocks should:
This maintains the correct priority chain:
Create a custom template override:
Then edit the custom copy with the changes above. This survives DA updates.
Note: Existing
Every DA server using
If this isn't the best way to get this information, please direct me to the best place.
Best regards.
rspamd: via CustomBuild (spamd=rspamd)
Affected template: /usr/local/directadmin/data/templates/rspamd_settings.conf
Summary
The
rspamd_settings.conf template generates per-user whitelist blocks in /etc/rspamd/users.d/*.conf that never take effect due to two issues:1. Priority bug: whitelist blocks use
priority = 4 (hardcoded), but prefs blocks use priority = medium (which equals 5 in rspamd). Since rspamd selects the highest-priority matching settings block, _prefs (5) always wins over _whitelist (4). The whitelist settings are never applied.2. Missing apply.actions: Even if the priority were correct, whitelist blocks only have
want_spam = yes without an apply { actions { ... } } override. This means rspamd still adds X-Spam-Status: Yes headers, and Exim's domain filter still routes the message to the spam folder.Note: The
_blacklist blocks in the same template correctly use priority = high (=10) and include apply { actions { ... } }. So blacklisting works, but whitelisting does not.How to reproduce
- As a DA user, go to E-Mail → SpamAssassin Setup → Whitelist
- Add a sender address (e.g., [email protected])
- Check the generated
/etc/rspamd/users.d/USERNAME.conf - Send a message from that whitelisted address with a score above the user's threshold
- Expected: message delivered to inbox (whitelist should override)
- Actual: message delivered to spam folder — rspamd applied
_prefssettings (priority medium=5) instead of_whitelist(priority 4)
You can confirm which settings block rspamd selected in the log:
Code:
grep "settings.lua" /var/log/rspamd/rspamd.log | grep USERNAME
It will always show
settings_id: USERNAME_prefs — never USERNAME_whitelist.Current template (whitelist section)
Code:
|*if whitelist_count>"0"|
|WHITELIST_ID| {
priority = 4; ← lower than _prefs (medium=5)
|CUSTOM12|
|RCPT|
|whitelist_from_list|
want_spam = yes; ← no apply.actions block
|CUSTOM13|
}
Suggested fix
The whitelist blocks should:
- Use a priority higher than medium (e.g., 6) so they override
_prefs - Include
apply { actions { ... } }to actually suppress spam marking
Code:
|*if whitelist_count>"0"|
|WHITELIST_ID| {
priority = 6;
|CUSTOM12|
|RCPT|
|whitelist_from_list|
want_spam = yes;
apply {
actions {
"add header" = 9999;
"rewrite subject" = null;
}
}
|CUSTOM13|
}
This maintains the correct priority chain:
Code:
blacklist (high=10) > whitelist (6) > prefs (medium=5) > default
Workaround
Create a custom template override:
Code:
mkdir -p /usr/local/directadmin/data/templates/custom/
cp /usr/local/directadmin/data/templates/rspamd_settings.conf \
/usr/local/directadmin/data/templates/custom/rspamd_settings.conf
Then edit the custom copy with the changes above. This survives DA updates.
Note: Existing
users.d/*.conf files need manual patching or a user action (changing SA prefs in the panel) to be regenerated from the new template.Related threads
- Rspamd (possible) bug found in DA generated user settings conf — 2019 bug where
_blacklistusedactioninstead ofapply { actions }. Fixed for blacklist, but whitelist was never given anapplyblock. - Whitelist/Blacklist not work with Exim + Rspamd — 2020 report describing the same symptom (whitelist not working), never resolved.
Impact
Every DA server using
spamd=rspamd where users have configured SpamAssassin whitelists via the panel is affected. The whitelist entries are stored correctly in user_prefs and appear in the generated users.d/*.conf, but they have no practical effect on mail delivery.If this isn't the best way to get this information, please direct me to the best place.
Best regards.