Any guide or tips for migrating from Spamassassin to Rspamd?

Richard G

Verified User
Joined
Jul 6, 2008
Messages
14,979
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.
 
or rate-limited.
I think it's that and that is what I'm worried about. Because I had rate limit issues before with SA too, which caused me to take an account at spamhaus.org and also set this lines in the local.cf of SA:
Code:
dns_query_restriction deny bl.score.senderscore.com
dns_query_restriction deny sa-accredit.habeas.com
dns_query_restriction deny sa-trusted.bondedsender.org
I don't want these to be queried anymore so I hope I can block these in rspamd too.

I also didn't say I wanted to abandon rspamd, just set it back to SA now, because I can't work with a broken system on a live server. So back to SA until I can fix the rspamd issues I'm having. I clearly stated "had to roll back for the moment". I would love to start rspamd again.

About resolving and such.
multi.uribl.com (127.0.0.1 returned) means URIBL is blocking queries from the resolver/IP.
So that is a real issue then correct? How can I fix this, same for Spamhaus which I do have a free key for. I could use Spamhaus in Exim but for some time I'm using the sh.cf and sh_scores.cf files for it in SA.
It's not much use if queries get blocked. Especially since our mail flow is rather low compared to most hosting company's.

As for the resolver, we are running bind as a DNS server on our servers and I don't think it's upstreaming, as far as I know it's also caching DNS server. But some of the domains just not turn up with an A record like for example multi.uribl.com which also shows that 127.0.0.1 is working fine as resolver. At least I don't see any forward, neither is any forwarder specified in the named.conf file:
Code:
;; AUTHORITY SECTION:
multi.uribl.com.        5       IN      SOA     uribl.com. dnsadmin.uribl.com. 1795703164 900 450 604800 5

;; Query time: 266 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Nov 26 15:27:45 CET 2026
;; MSG SIZE  rcvd: 117

The fuzzy-a.rspamd.com is giving a correct answer:
Code:
;; ANSWER SECTION:
fuzzy-a.rspamd.com.     3600    IN      A       80.241.57.6

So some of the errors are clear to me as some subdomains do not have a records like multi.uribl.com and also dwl.dnswl.org which also answers the same as multi.uribl.com so I think that is nothing to worry about indeed.

But seems my issue is not my 127.0.0.1 resolver. Also when doing an nslookup only the 127.0.0.1 resolver is mentioned.

@youstable first of all thank you for your patience and great help.
Before enabling Rspamd again, I would run:
Tried that after I went back to SA last night, but didn't work as the rspamadm binary is removed when going back to SA. I will do that when I will try rspamd again for sure. But as you can see local bind resolver is working fine.

So what I'm worried about are these things:
1.)
DNS query blocked on multi.uribl.com (127.0.0.1 returned), possibly due to high volume
We don't have high volume.
We do have a Hetzner ip and I've read on Github there was an issue with resolving when IPv6 was used from Hetzner. Seems that was fixed, but I remember that I had some kind of issues with Spamassassin using another resolver some way which caused me to add this setting in the local.cf so ipv4 was forced used for queries and then problems seemed to be gone.
dns_server 127.0.0.1
do I need to set this somewhere in rspamd too? I got multiple entry's in the /etc/resolv.conf file with 127.0.0.1 first after the search domain.
Should I put the ipv6 localhost as second in the resolv.conf file?
How can I fix the blocked queries which do not seem to happen in SA or SA is not queirying multi.uribl.com which is also possible (didn't check).

2.) Do I need to worry about the dead monitor status messages?

3.) How to I fix the DNS spoofing messages as it says either DNS spoofing or BL internal issue Can it be internal issues on my config? When I tested last night, there was also no mail coming in or going out but the log kept spewing these. Do I need to put my spamhaus key somewhere?

This is one of the mails that rspamd treated so seems it was working, althou I have my questions about something. Made some new lines to make it more readable.
Code:
2026-11-26 01:23:53 #1934928(normal) <8c7249>; task; rspamd_task_write_log: id: <[email protected]>, qid: <1xWNHE-00000008SK8-13sX>, ip: 67.21.148.154,
from: <[email protected]>, (default: F (no action): [-1.11/7.00]
[DMARC_POLICY_ALLOW(-0.50){thatericalper.com;quarantine;},RWL_MAILSPIKE_EXCELLENT(-0.40){67.21.148.154:from;},FORGED_SENDER(0.30){[email protected];
[email protected];},R_SPF_ALLOW(-0.20){+mx;},MIME_GOOD(-0.10){multipart/alternative;text/plain;},R_DKIM_ALIGNED(-0.10){strict;},R_DKIM_ALLOW(-0.10){thatericalper.com:s=mistmail;},
HAS_LIST_UNSUB(-0.01){},ARC_NA(0.00){},ASN(0.00){asn:7311;ipnet:67.21.144.0/20;country:CA;},DKIM_TRACE(0.00){thatericalper.com:+;},
FROM_HAS_DN(0.00){},FROM_NEQ_ENVFROM(0.00){[email protected];[email protected];},HAS_REPLYTO(0.00){[email protected];},
MIME_TRACE(0.00){0:+;1:+;2:~;},MISSING_XM_UA(0.00){},PREVIOUSLY_DELIVERED(0.00){[email protected];},RCPT_COUNT_ONE 0.00)1;},
RCVD_COUNT_THREE(0.00){3;},RCVD_TLS_ALL(0.00){},RCVD_VIA_SMTP_AUTH(0.00){},REDIRECTOR_URL(0.00){twitter.com;}
,REPLYTO_DOM_EQ_FROM_DOM(0.00){},REPLYTO_DOM_NEQ_TO_DOM(0.00){},SURBL_MULTI_FAIL(0.00)
{spamfilter.pssnet.com:server fail;www.thatericalper.com:server fail;open.spotify.com:server fail;},TEXT_WORDS_TRUNCATED(0.00){sampled=1;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 31221, time: 583.40
0ms, dns req: 61, digest: <731acd6fed2080a98d933717125ac5ed>, rcpts: <[email protected]>, mime_rcpts: <[email protected]>, settings_id: customer_prefs

My question is about this part:
spamfilter.pssnet.com:server fail;www.thatericalper.com:server fail;open.spotify.com:server fail
Is this on my side? Because my server resolves both those domains perfectly. So why server fail? Or not on my side so nothing to worry about?

Sorry for the long and extended message, but maybe it's just some small fix to add something somewhere (like my spamhaus key and maybe force dns resolver to 127.0.0.1 or something).
 
Last edited:
Back
Top