Difference between revisions of "Spamassassin on CentOS 6"

From vpsget wiki
Jump to: navigation, search
Line 15: Line 15:
  nano /etc/mail/spamassassin/local.cf
  nano /etc/mail/spamassassin/local.cf
Uncomment or add the following line:
Uncomment or add the following lines:
  required_hits 5.0
  required_hits 5.0

Revision as of 12:47, 12 August 2015


Firstly you need to update your OS distribution to latest version:

yum update -y

Install Spamassassin:

yum install spamassassin


Open spamassassin configuration file:

nano /etc/mail/spamassassin/local.cf

Uncomment or add the following lines:

required_hits 5.0
report_safe 0
required_score 5
rewrite_header Subject [SPAM]

Add user and group for spamassassin and change owner of log directory:

groupadd spamd
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
chown spamd:spamd /var/log/spamassassin

Integration to Postfix

Open postfix master.cf file:

nano /etc/postfix/master.cf

We should now change the master.cf file to look as follows:

# ====================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#                      (yes)   (yes)     (yes)    (never)   (100)
# ====================================================================
smtp        inet   n           -           n          -             -    smtpd -o content_filter=spamassassin

At the bottom of this file we should add the following line:

spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Before starting the spamassassin service use this command:

sa-update && /etc/init.d/spamassassin reload

Now you can to start spamassassin:

/etc/init.d/postfix reload
/etc/init.d/spamassassin reload


Create an email from any address and service outside of your domain, e.g. Yahoo or Gmail. Address the email to an email address on the newly-configured mail server, then within the subject line we can use the following test string:


If you will see [SPAM] in the subject line, Spamassassin work correctly.