Email 5 min read

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.

By BashPilot Team
BashEmail Email spam protection Keep outbound mail clean and off blacklists, automatically. Explore BashEmail

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

SpamAssassinRspamd
LanguagePerlC, with Lua for rules and plugins
Typical reason to choose itLong history, familiar rule files, many existing setupsLower cost per message on busy servers, built-in web interface
On DirectAdminPer-user settings in ~/.spamassassin/user_prefsReads the same per-user files, plus /etc/rspamd/users.d/USERNAME.conf
Learned dataBayes databaseIts 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.

switch to Rspamd
da build set spamd rspamd
da build rspamd
roll back to SpamAssassin
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.

regenerate one user's Rspamd configuration
echo "action=rewrite&value=rspamd&user=USERNAME" >> /usr/local/directadmin/data/task.queue

Settings that reduce spam more than the engine choice

  1. 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. 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, then systemctl restart exim.

  3. 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_domains for domains that must accept everything.

  4. 4

    Keep custom rules where DirectAdmin will not overwrite them

    Custom lines in user_prefs belong between the #SAFE AREA start and #SAFE AREA end markers, 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_prefs file, and one without it does not get scanned, so you know the behaviour customers will see.
  • Watch /var/log/exim/mainlog and /var/log/exim/rejectlog after 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.

Share LinkedIn X
Questions

Frequently asked questions

Does DirectAdmin use SpamAssassin or Rspamd?

Either. CustomBuild selects the engine with the `spamd` option: `da build set spamd spamassassin` then `da build spamassassin`, or `da build set spamd rspamd` then `da build rspamd`. DirectAdmin describes Rspamd as a drop-in replacement that reads the same per-user configuration files.

Is Rspamd better than SpamAssassin?

It is usually lighter on a busy server, since it is written in C with Lua while SpamAssassin is Perl. Accuracy depends heavily on training and on the mail involved, and a well-trained SpamAssassin performs well. Switch for performance or features, not on the assumption that spam will disappear.

Why is DirectAdmin not filtering spam for a user?

Check whether the user enabled SpamAssassin at User Level. DirectAdmin's documentation says that creates `~/.spamassassin/user_prefs`, and mail is not scanned without that file unless your version enables scanning by default. Also check that their mail client or webmail filter is not moving tagged messages back to the inbox.

Why does DirectAdmin drop mail that fails SPF or DKIM?

Easy Spam Fighter gives a full failure of rDNS, SPF or DKIM a score of 100, which equals the default drop score. You can lower those values in `/etc/exim.easy_spam_fighter/variables.conf.custom`, for example `EASY_SPF_FAIL==60`, and restart Exim so they count toward the score instead of dropping the message.

How do I limit how many emails a DirectAdmin user can send?

DirectAdmin uses `/etc/virtual/limit` as the server-wide daily limit and `/etc/virtual/limit_USERNAME` for a specific user. Resellers normally set the user's value under List Users. A daily limit stops a compromised account from sending thousands of messages before anyone notices.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.