Author Topic: How to configure Spamassassin [updated]  (Read 139 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to configure Spamassassin [updated]
« on: December 03, 2024, 11:04:53 PM »
Informations about configure Spamassassin appear to be outdated.

If you follow the wiki https://wiki.centos-webpanel.com/how-to-configure-spamassassin you will got an error with the daemon config and even solving this the spamd will consume a lot of load and will not work, as mentioned in https://forum.centos-webpanel.com/e-mail/spamassassin-service-failed-with-result-start-limit-hit/msg38072/#msg38072

I'll join here all steps to configure and ask for you, what is wrong? Let's make new and functional instructions to configure o spamassassin, please.

Assume that mail server built with ClamAV+SA+Amavis at MailServer Manager and working, but spamassassin is not marking *SPAM* and is not moving messages to Spam folder.

Add line "  -o content_filter=spamassassin" at /etc/postfix/master.cf after  "  -o receive_override_options=no_address_mappings", you will get:

Code: [Select]
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=smtp-amavis:127.0.0.1:10024
  -o receive_override_options=no_address_mappings
  -o content_filter=spamassassin

*do NOT forget about two spaces before -o

At end of same file /etc/postfix/master.cf add:

Code: [Select]
spamassassin      unix -      n      n      -      -      pipe
  user=nobody argv=/usr/bin/spamc -f -e
  /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Check if /var/lib/spamassassin/ exist, if not create. Check if user and groutp owned by nobody.

At file /etc/sysconfig/spamassassin edit to:

Code: [Select]
SAHOME="/var/lib/spamassassin/"
SPAMDOPTIONS="-d -c -m5 -u nobody -s ${SAHOME}spamd.log"

** Here we have a problem, with -d option (Detach from starting process and run in background) you will have spamd consuming a lot of load, even not working. This is mentioned at
https://forum.centos-webpanel.com/e-mail/spamassassin-service-failed-with-result-start-limit-hit/msg38072/#msg38072 . So we can remove it? As for me both options did not work I don't know what can be better yet.

Edit /usr/share/spamassassin/local.cf with default options:

Code: [Select]
rewrite_header Subject *SPAM*
# report_safe 1
# trusted_networks 212.17.35.
required_score 5.0
use_bayes 1
bayes_auto_learn 1
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
include /usr/share/spamassassin/

Maybe this file is not loading. As mentioned at https://forum.centos-webpanel.com/e-mail/spamassassin-service-failed-with-result-start-limit-hit/msg38072/#msg38072 this configuration must be set in another place, but where and how? Searching I found that can be any new file at /usr/share/spamassassin/ or /etc/mail/spamassassin, I've tried creating custom.cf, inserting default options, but didn't work. Even editing /etc/mail/spamassassin/local.cf

Here the configuration should be complete, but no. You'll get an error: spamassassin.service: Failed with result 'start-limit-hit' after reload spamd.

You need to edit /usr/lib/systemd/system/spamassassin.service, inside Service section add:

Code: [Select]
StartLimitBurst=0
Reload deamon, restart postfix and spamassassin:

Code: [Select]
systemctl daemon-reload
sa-update
systemctl restart postfix spamassassin

* Here we should restart Amavis too?

So with that I have spamassassin started, without error, but not marking and moving spam : (

Please, lets help to update this instructions. Spamassassin is so important and I hope soon cwp have this configuration included at MailServer Manager.

Offline
*
Re: How to configure Spamassassin [updated]
« Reply #1 on: December 16, 2024, 06:51:35 PM »
Hi, I have same problem. I want the spam to be delivered in the SPAM folder. But I also get a broken PIPE error in the logs. Is someone able to get the spamassassin to work? Hope you can help!