What is SpamAssassin?
It is a program released under the Apache License 2.0 used for e-mail spam filtering based on content-matching rules.
UPDATE THE SYSTEM
As usual, make sure your CentOS 6 linux vps is fully up to date by executing:
## screen -U -S spamc-screen ## yum update
INSTALL SPAMASSASSIN
Install the SpamAssassin package using yum
by running:
## yum install spamassassin
SET-UP USER
create spamfilter
group used for the user that will run the spamassassin
service
## groupadd spamfilter
create new user spamfilter
with a home directory of /usr/local/spamassassin
and add it to the spamfilter
group you just created
## useradd -g spamfilter -s /bin/false -d /usr/local/spamassassin spamfilter ## chown spamfilter: /usr/local/spamassassin
CONFIGURE SPAMASSASSIN
next, configure spamassassin
by editing /etc/mail/spamassassin/local.cf
and adding/setting the following
## vim /etc/mail/spamassassin/local.cf ## 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
before we proceed with starting-up the spamassassin
service, we need to make sure it runs with our newly created spamfilter
user by editing /etc/sysconfig/spamassassin
and setting-up the following:
## vim /etc/sysconfig/spamassassin # 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"
with all that in place, we are ready to start and enable the spamassassin
service on system startup using:
## service spamassassin start ## chkconfig spamassassin on
Fuente: https://www.rosehosting.com/blog/how-to-install-and-integrate-spamassassin-with-postfix-on-a-centos-6-vps/