Symptoms
-
The following errors can be found in
/var/log/maillog
:# cat /var/log/maillog | grep -i fail | grep -i spam | less
spamc[32154]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection refusedOr
# cat /var/log/maillog | grep -i fail | grep -i spam | less
spamc[32154]: connect to spamd on ::1 failed, retrying (#3 of 3): Connection refused -
The
127.0.0.1
IP address is assigned to several network interfaces:# ifconfig |grep -C 1 127
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
--
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255 -
SpamAssassin service is listening to public IP:
# netstat -tulpn | grep spam
tcp 0 0 203.0.113.2:783 0.0.0.0:* LISTEN 1018/.spamassassin
Cause
Unclear.
Resolution
Note: This article may require additional administrative knowledge to apply. If any help required, contact the server’s administrator or hosting support.
Re-assign SpamAssassin work process on server IP address, e.g 203.0.113.2
:
-
Connect to the server via SSH.
-
For the
spamd
service add the following parameters in/etc/sysconfig/spamassassin
using the command below:# echo -e 'nSPAMDOPTIONS="-i 203.0.113.2 -A 203.0.113.2 --nouser-config --username=popuser --daemonize --helper-home-dir=/var/qmail --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --create-prefs --max-children=1"' >> /etc/default/spamassassin
-
For
spamc
service edit/etc/mail/spamassassin/spamc.conf
and add the parameter-d 203.0.113.2
in it.
So the file will look as follows:# cat /etc/mail/spamassassin/spamc.conf
-d 203.0.113.2
Re-assign SpamAssassin work process on localhost
:
-
Connect to the server via SSH
-
Add the following parameters in
/etc/default/spamassassin
:# grep OPTIONS /etc/default/spamassassin | grep -v "#"
OPTIONS="-i 127.0.0.1 -A 127.0.0.1 --create-prefs --daemonize --helper-home-dir=/var/qmail --max-children=1 --nouser-config --username=popuser --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin" -
Restart the service:
# systemctl stop spamassassin.service
# systemctl start spamassassin.service