Centos 7 : Setup Spamassassin
02-23-2015, 07:32 AM
(This post was last modified: 02-24-2015, 07:48 AM by Untouchable.)
All steps that described bellow, tested and working on Centos 7 Vps + Sentora 1.0.0
1. Before we start, lets check for updates
2. Let's install now spamassassin, ( about 10mb )
3. Time for configuration
You have to add the following lines, if already there just uncoment #
Required_hits 5 is for small mail serv. You can increase it more if you need
Report_safe is on 0 here, but you can change to 1 or 2 ( see spamassassin guides )
Rewrite_header we call it ***SPAM*** here, you can call it as you want
Required_score can set form 0 -> 5 depends what you need
4. Now let's create a unique user and group
5. Configure the Postfix master.cf file to use the SpamAssassin
About line 11 in top add after smtpd Full line looks like that
And the end - bottom add
6. Update spamassassin rules
7. Restart postfix - spamassassin
8. Check if spamassassin is listening
9. Test : create and send an email from external mail service with subject
On roundcube webmail it will be marked as spam.
Test spam message to see if it works : http://spamassassin.apache.org/gtube/
1. Before we start, lets check for updates
Code:
su -c 'yum update'
2. Let's install now spamassassin, ( about 10mb )
Code:
sudo yum install spamassassin
3. Time for configuration
Code:
sudo nano /etc/mail/spamassassin/local.cf
Code:
rewrite_header Subject ***SPAM***
Code:
required_hits 5.0
Code:
report_safe 0
Code:
required_score 5
Required_hits 5 is for small mail serv. You can increase it more if you need
Report_safe is on 0 here, but you can change to 1 or 2 ( see spamassassin guides )
Rewrite_header we call it ***SPAM*** here, you can call it as you want
Required_score can set form 0 -> 5 depends what you need
4. Now let's create a unique user and group
Code:
sudo groupadd spamd
Code:
sudo useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
Code:
sudo chown spamd:spamd /var/log/spamassassin
5. Configure the Postfix master.cf file to use the SpamAssassin
Code:
sudo nano /etc/postfix/master.cf
Code:
-o content_filter=spamassassin
Code:
smtp inet n - n - - smtpd -o content_filter=spamassassin
Code:
spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
6. Update spamassassin rules
Code:
sa-update --nogpg
7. Restart postfix - spamassassin
Code:
systemctl restart spamassassin
Code:
systemctl restart postfix
8. Check if spamassassin is listening
Code:
ss -tnlp | grep spamd
9. Test : create and send an email from external mail service with subject
Code:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
Test spam message to see if it works : http://spamassassin.apache.org/gtube/