Any guide or tips for migrating from Spamassassin to Rspamd?

Richard G

Verified User
Joined
Jul 6, 2008
Messages
14,978
Location
Maastricht
We would like to migrate from Spamassassin to Rspamd.
The installation commands are not too hard to do, but what other things need to be done, what do I have to keep in mind?

Also, at this moment, several users have their own settings so the user_prefs or custom .cf files. Can these be converted to rspamd or does this work differently and I need to thrown them away (or backup in case I need to go back to SA)?

At this moment I also have a post creation script which creates some default settings on creation of a user account. Can this also be done for rspamd?

I don't have a test server at the moment and need to migrate a live server so any help/tips/guides are greatly appreciated!
 
Treat this as two separate things: DirectAdmin-managed user settings and hand-written SpamAssassin rules.

Rspamd is a drop-in replacement at DA's integration layer. DA continues to use the existing user_prefs as its source and generates /etc/rspamd/users.d/USERNAME.conf. Arbitrary SA .cf/header/meta rules are not Rspamd syntax, so inventory and back them up; translate those manually into Rspamd local.d/override.d rather than copying them.

The documented switch is:

da build set spamd rspamd
da build rspamd

Before doing it on a live box, back up the current CustomBuild, Exim and SA configs. Afterward, rewrite one user's Rspamd config from DA, compare it, then test a normal message plus GTUBE before rewriting all users. Also verify Exim headers, Rspamd logs and queue flow.

For rollback, DA documents:

da build set spamd spamassassin
da build remove_rspamd
da build spamassassin
da build exim_conf

Your post-create hook is probably no longer needed merely to enable scanning: DA 1.669+ enables it by default when allowed. If the hook adds custom defaults, keep the intent but generate DA/Rspamd settings, not raw SA rules.

Official guide: https://docs.directadmin.com/other-hosting-services/preventing-spam/incoming-spam.html
 
First of all, thank you *very* much for your quick reply and your insights!

then test a normal message plus GTUBE
What is GTUBE? You mean mail to/from gmail or something else?

Is there a good command to rewrite all users? I'm not that good in those replace all commands.

There are 3 things I created by default by that posthook previously. That was a filter, filter.conf and user_prefs file. But I just remembered that the hook was deleted some time ago and I switched to a more modern spam_defaults.json file in the custom template directory with this content.
Code:
{
        "high_score" : "5",
        "high_score_block" : "yes",
        "rewrite_subject" : "1",
        "subject_tag" : "*****SPAM*****",
        "where" : "userspamfolder",
        "report_safe" : "1"
}
So nothing very special, just rewriting subject and setting the score a bit different.

As far as I know I only made some custom changes in the local.cf file from SA.

da build remove_rspamd
Just to be sure. Don't I also need to do a "da build remove_spamassassin" once rspamd is running well?

before rewriting all users
If turning back to SA is there also a command to rewrite back or is that not needed?
 
Last edited:
Had to go back to SA for the moment.
Got loads of these errors in the rspamd logfile.
Code:
2026-11-26 01:05:34 #1934931(normal) <wmggjd>; upstream; rspamd_upstream_resolve_addrs: do not resolve upstream fuzzy-b.rspamd.com: cooldown remains 59 seconds
2026-11-26 01:05:34 #1934931(normal) <me7iow>; upstream; rspamd_upstream_resolve_addrs: do not resolve upstream fuzzy-a.rspamd.com: cooldown remains 59 seconds
2026-11-26 01:05:34 #1934929(normal) <me7iow>; upstream; rspamd_upstream_resolve_addrs: do not resolve upstream fuzzy-a.rspamd.com: cooldown remains 59 seconds
2026-11-26 01:05:40 #1934927(controller) <1jqufq>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for dbl.spamhaus.org while 'no records with this name' was expected when querying for 'vTZlxtlKzokyLqwfHPP4mdxKkJMUZQO.dbl.spamhaus.org'(likely DNS spoofing or BL internal issues)
2026-11-26 01:05:40 #1934927(controller) <1ccygw>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for dwl.dnswl.org while 'no records with this name' was expected when querying for 'wkD8spGpDTHsTg3pb.dwl.dnswl.org'(likely DNS spoofing or BL internal issues)
2026-11-26 01:05:41 #1934927(controller) <imhkkk>; monitored; rspamd_monitored_dns_cb: DNS query blocked on multi.uribl.com (127.0.0.1 returned), possibly due to high volume
2026-11-26 01:05:42 #1934927(controller) <c9hxbz>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for zen.spamhaus.org while 'no records with this name' was expected when querying for '1.0.0.127.zen.spamhaus.org'(likely DNS spoofing or BL internal issues)
2026-11-26 01:06:13 #1934927(controller) <1ccygw>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for dwl.dnswl.org while 'no records with this name' was expected when querying for '5XpXKvk8.dwl.dnswl.org'(likely DNS spoofing or BL internal issues)

And this:
Code:
2026-11-26 01:08:08 #1934928(normal) <qxyfew>; cfg; rspamd_worker_monitored_handler: updated monitored status for 1jqufqqgiuzucy7rfzfco8ji4aw6bph: dead

As for the DNS lists, I remember that I had disabled several of these in Spamassassin because they were already also used by Exim. I do have a key for Spamhaus.org and use local DNS resolver with which I had no issues before.

And these again:
Code:
2026-11-26 01:10:31 #1934927(controller) <9oqwi6>; map; http_map_finish: data is not modified for server sa-update.surbl.org (http://sa-update.surbl.org/rspamd/surbl-hashbl-map.inc), next check at Thu, 26 Nov 2026 00:30:31 GMT (timer based)
2026-11-26 01:10:48 #1934927(controller) <1jqufq>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for dbl.spamhaus.org while 'no records with this name' was expected when querying for 'YUVhz2bk.dbl.spamhaus.org'(likely DNS spoofing or BL internal issues)
2026-11-26 01:11:01 #1934927(controller) <imhkkk>; monitored; rspamd_monitored_dns_cb: DNS query blocked on multi.uribl.com (127.0.0.1 returned), possibly due to high volume
2026-11-26 01:11:11 #1934927(controller) <1ccygw>; monitored; rspamd_monitored_dns_cb: DNS reply returned 'no error' for dwl.dnswl.org while 'no records with this name' was expected when querying for 'jLy3UVbTxvZHfy.dwl.dnswl.org'(likely DNS spoofing or BL internal issues)

I've also encountered some of these in the rspamd.log file.
Code:
2026-11-26 01:26:31 #1934927(controller) <48c21d>; csession; rspamd_controller_check_password: allow unauthorized connection from a unix socket
2026-11-26 01:26:31 #1934927(controller) <d1bc04>; csession; rspamd_controller_check_password: allow unauthorized connection from a unix socket
2026-11-26 01:26:31 #1934927(controller) <0ab4b6>; csession; rspamd_controller_check_password: allow unauthorized connection from a unix socket
Sounds suspicious to me. And then I didn't even change anythingyet.

So I need to fix these first before I can set it back up again, and don't know how.
 
Those log lines look more like health-check noise than a reason to abandon Rspamd. The fuzzy upstream cooldown just means an external fuzzy service was temporarily unreachable or rate-limited. The monitored DNSBL warnings often happen when public blocklists refuse or rate-limit test queries, especially from a busy mail server; they do not necessarily mean scanning is broken. Before rolling back again, check the resolver Rspamd uses, lower or disable monitored public lists that throttle you, and verify real spam/ham scoring and mail flow. Treat the rollback as a test, not proof Rspamd cannot work.
 
The important ones are the DNSBL monitoring errors:

likely DNS spoofing means Rspamd expected an NXDOMAIN response for a random test hostname but received a different answer.
multi.uribl.com (127.0.0.1 returned) means URIBL is blocking queries from the resolver/IP.
The fuzzy-server cooldown messages indicate temporary DNS resolution or connectivity failures.
Even when resolv.conf points to 127.0.0.1, the local resolver may still forward queries to another DNS service or rewrite NXDOMAIN responses. I would check that first.

These messages are normally harmless:

data is not modified only means the downloaded map has not changed.
allow unauthorized connection from a unix socket refers to a trusted local Unix socket used by DirectAdmin/Rspamd. It is not an unauthorised remote connection.
Before enabling Rspamd again, I would run:
Code:
rspamadm configtest
cat /etc/resolv.conf
dig fuzzy-a.rspamd.com
dig multi.uribl.com
It would also help to know whether your local resolver is BIND, Unbound or something else, and whether it forwards queries upstream.

For rewriting every user after switching:

Code:
echo "action=rewrite&value=rspamd" >> /usr/local/directadmin/data/task.queue
GTUBE is just a harmless standard test string used to verify that the spam filter detects a message; it is unrelated to Gmail.

Your spam_defaults.json settings should remain the correct modern way to set those defaults. I would not remove SpamAssassin manually during testing. First get Rspamd stable and verify normal mail, spam scoring and DNSBL lookups. The documented rollback already restores SpamAssassin and rebuilds Exim:

Code:
da build set spamd spamassassin
da build remove_rspamd
da build spamassassin
da build exim_conf


There should be no need to rewrite users back to SpamAssassin because the original user_prefs files remain its source.

Sorry—I should have included these details in my first reply.
 
Back
Top