Symptoms
There are occasions where SPAMD fails to start with the following error:
systemctl status spamd
● spamd.service - Apache SpamAssassin™ deferral daemon
Loaded: loaded (/etc/systemd/system/spamd.service; static; vendor preset: disabled)
Active: activating (start) since Wed 2021-06-23 14:41:14 EDT; 2s ago
Control: 20807 (spamd-startup)
CGroup: /system.slice/spamd.service
└─20807 /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/libexec/spamd-startup --daemonize --allowed-ips=127.0.0.1,::1 --max-children=5 --pidfile=/var/run...
Jun 23 14:41:14 server.cpanel.tld systemd[1]: Starting Apache SpamAssassin™ deferral daemon...
Jun 23 14:41:14 server.cpanel.tld spamd[20813]: config: no rules were found! Do you need to run 'sa-update'?
This suggest that SpamAssassin's rules are missing and as a result SPAMD is not able to start. However, when trying to regenerate the missing rules with the update-sa command the following error is encountered:
/usr/local/cpanel/3rdparty/bin/sa-update
error: no mirror data available for channel updates.spamassassin.org
channel 'updates.spamassassin.org': MIRRORED.BY file contents were missing, channel failed
update-sa is complaining about the MIRROR.BY file missing. You can confirm the file is indeed missing with the following command:
ls -Flathr /var/lib/spamassassin/*/updates_spamassassin_org/MIRRORED.BY
ls: cannot access /var/lib/spamassassin/*/updates_spamassassin_org/MIRRORED.BY: No such file or directory
Description
update-sa needs the MIRROR.BY file to be able to generate the missing rules and in the event when the file is missing, the file is usually downloaded from this URL:
lynx --dump http://spamassassin.apache.org/updates/MIRRORED.BY
#HOW TO UPDATE # # SOURCE:
https://svn.apache.org/repos/asf/spamassassin/site/updates/ # # 'svn
checkout' the repo, update this file, and commit it # # A svnpubsub
update on spamassassin.apache.org will instantly pull # from SVN after
the commit. # # A cron'd update on sa-vm.apache.org will also
automatically pull # from SVN to /www/spamassassin.apache.org/updates
which is also the # [updates] rsync module path the mirrors are syncing
from. # test mirror: zone, cached via Coral
#http://buildbot.spamassassin.org.nyud.net:8090/updatestage/ #CONTACT:
Daryl C. O'Shea #Removed on 2012-09-26 per bug 6838
#http://daryl.dostech.ca/sa-update/asf/ weight=5 #CONTACT: Matthias
Leisi http://sa-update.dnswl.org/ weight=3 #CONTACT: Kevin A. McGrail
http://www.sa-update.pccc.com/ weight=5 #CONTACT: John Meyer - Removed
2020-09-17 #http://sa-update.secnap.net/ weight=5 #CONTACT: Rene
Schwarz http://sa-update.space-pro.be/ weight=1 #CONTACT: Dave Jones
http://sa-update.ena.com/ weight=5 #CONTACT: Dave Warren
http://sa-update.razx.cloud/ weight=5 #CONTACT: Jens Schleusener
http://sa-update.fossies.org/ weight=1 #CONTACT: tobisworld gmail
http://sa-update.verein-clean.net/ weight=10 #CONTACT: Giovanni Bechis
http://sa-update-asf.snb.it/ weight=5 #CONTACT:
sysadmins@spamassassin.apache.org http://sa-update.spamassassin.org/
weight=10
You can download that file by the following command:
curl -o MIRROR.BY http://spamassassin.apache.org/updates/MIRRORED.BY
However, there are occasions that as a result of your server being rate-limited it is not possible to download the MIRROR.BY file anymore:
curl -I http://spamassassin.apache.org/updates/MIRRORED.BY
curl: (7) Failed to connect to 2a01:4f9:2a:1a61::2: Network is unreachable
In such situations if the MIRROR.BY file gets removed, which usually happens periodically, the SpamAssassin will not be able to download that file anymore and as a result it will not be able to update the rules and it will fail to start at some point.
Workaround
In cases where the server is still rate-limited, in order to get around this issue the file needs to be manually added to the server.
First you need to get the content of that file on a server that is NOT rate-limited:
curl http://spamassassin.apache.org/updates/MIRRORED.BY
Then copy and paste the content to the rate-limited server and create a file with the same name in this location:
/var/lib/spamassassin/$SPAMASSASSIN_VERSION/updates_spamassassin_org/MIRRORED.BY
You can get the SPAMASSASSIN_VERSION on your server with this: (On my server it's 3.004004)
rpm -q --queryformat "%{VERSION}" `rpm -qa | grep -Ei "cpanel-.*-Mail-SpamAssassin"`; echo
3.004004
Then confirm that the file exists:
ls -Flathr /var/lib/spamassassin/*/updates_spamassassin_org/MIRRORED.BY
-rw-r--r-- 1 root root 1.4K Jun 23 14:47 /var/lib/spamassassin/3.004004/updates_spamassassin_org/MIRRORED.BY
Now you are ready to run the update-sa command to generate the rules: (Might not show any output)
/usr/local/cpanel/3rdparty/bin/sa-update -vvv
And finally in the last step you should be able to restart SPAMD successfully:
systemctl restart spamd
Comments
0 comments
Article is closed for comments.