Author Topic: install and configure Spamassassin  (Read 9575 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
install and configure Spamassassin
« on: February 24, 2017, 11:53:53 AM »
It seems that spamassasin gets installed by centos web panel but not used.

To enable it do the following on your own risk!:

(Im on Centos 6, clean install)

yum -y update
yum -y install spamassassin
groupadd spamfilter
useradd -g spamfilter -s /bin/false -d /usr/local/spamassassin spamfilter
chown spamfilter: /usr/local/spamassassin

echo "## Required_hits: This determines the filter balance; the lower the score the more aggressive the filter.
# A setting of 5.0 is generally effective for a small organisation or a single user.
# Adjust the strictness score to your organization's needs - a large medical organisation might want  to let email items
# through that are trying to sell pharmaceuticals, so we might increase the level to a more modest 8.0.
required_hits 5
## Report_safe:  This line determines whether to delete the item or to move the item to the inbox whilst appending
# a spam notice to the subject line. The levels for this line are set to either a 1 or 0. A score of 1 will delete the spam item,
# whereas a score of 0 will send the item to the inbox and rewrite the subject line.
report_safe 0
rewrite_header Subject [**SPAM**]
## Required_score: This line sets the spam score for all email allowed through to your domain, with levels of certainty set from 0 to 5.
# Zero would be classified as a legitimate email item, whereas 5 would be an definite 'SPAM' item.  If we set the score to 3 we would catch a
# lot of unsolicited emails but quite a few false positives would still get through. For our example email server we will use the score of 5,
# but you can of course set this value according to your preference.
required_score 5.0" > /etc/mail/spamassassin/local.cf


echo "# Options to spamd
SAHOME="/usr/local/spamassassin"
SPID_DIR="/var/run/spamassassin"
SUSER="spamfilter"
SPAMDOPTIONS="-d -c -m5 --username ${SUSER} -H ${SAHOME} -s ${SAHOME}/spamfilter.log" > /etc/sysconfig/spamassassin

service spamassassin start
chkconfig spamassassin on


#edit /etc/postfix/master.cf and replace:

#
# Postfix master process configuration file.  For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ***** Unused items removed *****
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=smtp-amavis:127.0.0.1:10024
  -o receive_override_options=no_address_mappings
#
## Enable SMTP on port 587 only for authenticated/TLS clients
submission inet n       -       n       -       -       smtpd
  -o smtpd_enforce_tls=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject


#With :

#
# Postfix master process configuration file.  For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ***** Unused items removed *****
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
  -o content_filter=smtp-amavis:127.0.0.1:10024
  -o receive_override_options=no_address_mappings
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
spamassassin unix -     n       n       -       -       pipe user=spamfilter argv=/usr/bin/spamc -f -e  /usr/sbin/sendmail -oi -f ${sender} ${recipient}


#
## Enable SMTP on port 587 only for authenticated/TLS clients
submission inet n       -       n       -       -       smtpd
  -o smtpd_enforce_tls=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

save the file and then restart postfix



To test if SpamAssassin actually works, you can simply send an email with subject XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X to some of your email accounts (from an external one!) and once the email is received, check it’s headers and you should notice something like this:

X-Spam-Flag: YES
X-Spam-Level: **************************************************
X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,RCVD_IN_DNSWL_NONE,
    TVD_SPACE_RATIO autolearn=no version=3.3.1
....
This means that SpamAssassin is doing it’s job.

Maybe the developer can inlcude smth like this to his setup when installing, or just dont install spamassassin ))

Offline
***
Re: install and configure Spamassassin
« Reply #1 on: September 03, 2017, 04:01:29 AM »
My SSD disk was fulfilled completely  in a week, with logfile '/spamfilter.log' (at root directory) with the logs like:
=================================================================
Thu Aug 17 00:05:54 2017 [27835] info: spamd: server successfully spawned child process, pid 27838
Thu Aug 17 00:05:54 2017 [27835] info: spamd: server successfully spawned child process, pid 27839
Thu Aug 17 00:05:54 2017 [27838] error: spamd: cannot run as nonexistent user or root with -u option
Thu Aug 17 00:05:54 2017 [27835] info: prefork: child states: SS
Thu Aug 17 00:05:54 2017 [27835] info: spamd: server successfully spawned child process, pid 27840
Thu Aug 17 00:05:54 2017 [27835] info: prefork: adjust: 0 idle children less than 1 minimum idle children. Increasing spamd children: 27840 started.
Thu Aug 17 00:05:54 2017 [27839] error: spamd: cannot run as nonexistent user or root with -u option
Thu Aug 17 00:05:54 2017 [27835] info: prefork: child states: SSS
Thu Aug 17 00:05:54 2017 [27835] info: spamd: server successfully spawned child process, pid 27841
Thu Aug 17 00:05:54 2017 [27835] info: prefork: adjust: 0 idle children less than 1 minimum idle children. Increasing spamd children: 27841 started.
=================================================================

Seems the criptical is the "error:" line, claiming "spamd: cannot run as nonexistent user or root with -u option".
I don't know where to correct it.

Regards,
Netino

Offline
*
Re: install and configure Spamassassin
« Reply #2 on: August 31, 2018, 12:43:52 PM »
I sow today that SpamAssasin realy is not enabled on CWP :)
I thought all time that it is enabled.
Is there a plan to fix it by CWP or I need to configure it manually ?