DirectAdmin Spam Filter: SpamAssassin vs Rspamd
DirectAdmin can run either SpamAssassin or Rspamd, and the switch is two commands. Whether you should switch, and what to tune first, is the harder part.
A DirectAdmin spam filter is one of two engines, SpamAssassin or Rspamd, chosen through CustomBuild. Customers complaining about spam rarely care which one you run. They care whether junk reaches the inbox and whether real mail goes missing. The engine matters less than people think, and a few settings around it matter more.
How the two engines differ
| SpamAssassin | Rspamd | |
|---|---|---|
| Language | Perl | C, with Lua for rules and plugins |
| Typical reason to choose it | Long history, familiar rule files, many existing setups | Lower cost per message on busy servers, built-in web interface |
| On DirectAdmin | Per-user settings in ~/.spamassassin/user_prefs | Reads the same per-user files, plus /etc/rspamd/users.d/USERNAME.conf |
| Learned data | Bayes database | Its own statistics, not interchangeable with SpamAssassin's |
Comparisons of accuracy vary a lot depending on how long each filter has been trained and on whose mail. A well-trained SpamAssassin can match a fresh Rspamd, and published head-to-head numbers are hard to verify. The difference you will reliably notice is resource use under load, which favours Rspamd. If your server already runs SpamAssassin comfortably and customers are not complaining, there is no urgency to move.
Switch engines with CustomBuild
DirectAdmin documents the switch as two commands, and the rollback as four. Run them in a quiet period and watch the mail log while the first messages pass through.
da build set spamd rspamd
da build rspamd
da build set spamd spamassassin
da build remove_rspamd
da build spamassassin
da build exim_conf
Per-user overrides for Rspamd live in /etc/rspamd/users.d/USERNAME.conf and are loaded through /etc/rspamd/rspamd.conf.local. If a user's file needs regenerating, DirectAdmin documents queuing a rewrite rather than editing it by hand.
echo "action=rewrite&value=rspamd&user=USERNAME" >> /usr/local/directadmin/data/task.queue
Settings that reduce spam more than the engine choice
-
1
Make sure scanning is actually on
Users enable it under the SpamAssassin section at User Level, which creates
~/.spamassassin/user_prefs. DirectAdmin's documentation says mail is not scanned without that file, unless your version enables scanning by default. Many "the filter does nothing" tickets end here. -
2
Review Easy Spam Fighter's hard drops
By default a full failure of rDNS, SPF or DKIM scores 100, equal to the drop score, so the message is dropped. To count them toward a score instead, DirectAdmin documents lowering them, for example
echo "EASY_SPF_FAIL==60" >> /etc/exim.easy_spam_fighter/variables.conf.custom, thensystemctl restart exim. -
3
Decide on RBL blocking
Admin Level, Admin Settings, Use RBL Blocking rejects mail from listed sources at connection time. DirectAdmin notes SpamAssassin already uses RBLs in its scoring, so this is the aggressive option, best with a skip list in
/etc/virtual/skip_rbl_domainsfor domains that must accept everything. -
4
Keep custom rules where DirectAdmin will not overwrite them
Custom lines in
user_prefsbelong between the#SAFE AREA startand#SAFE AREA endmarkers, which DirectAdmin preserves when the user saves settings.
Do not forget outgoing spam
An inbound filter protects your customers' inboxes. Your server's reputation depends on what it sends. DirectAdmin can count and cap each user's outgoing mail per day, with a server-wide default in /etc/virtual/limit and a per-user value in /etc/virtual/limit_USERNAME, normally set by a reseller under List Users. A cap like that turns a compromised account from a blocklisting into a support ticket. If your server's mail is already being refused, start with Gmail 550 5.7.25 Error: Fix Your Mail Server's PTR Record and the authentication checks in Postfix Rejecting Mail? Fix SPF, DKIM and DMARC Failures, which apply to Exim servers too.
Verify the filter is working
- Send a message from an outside account to a test mailbox and check its headers for the spam score your engine adds.
- Confirm that a user with scanning enabled has the
user_prefsfile, and one without it does not get scanned, so you know the behaviour customers will see. - Watch
/var/log/exim/mainlogand/var/log/exim/rejectlogafter any change for a rise in rejections of mail you expected to accept.
Where BashEmail fits on DirectAdmin
SpamAssassin and Rspamd score messages. Running a mail service for customers also means quarantine they can review, policies that differ by domain or mailbox, and a way to stop a compromised sender without locking the customer out. BashEmail for DirectAdmin filters incoming spam and malware and contains outgoing abuse while mail and quarantine stay on your DirectAdmin server. It begins in an observe-only state so you can see likely outcomes before enforcing them, and it is designed to fail open, so an unavailable filter does not stop mail.