Ubuntu :How to setup Spamassassin
07-18-2014, 07:35 AM
(This post was last modified: 10-16-2014, 04:50 PM by Diablo925.)
How to setup Spamassassin
1: Use apt-get to install Spamassassin and spamc.
Add Spamassassin user
2: First add the group spams:
3: Then add the user spamd with the home irectory /var/log/spamassassin:
4: then create the directory /var/log/spamassassin and change the ownership:
Setting Up Spamassassin
5: Open the spamassassin config file using:
6: Setting up spamassassin
save and exit
7: Now create a variable named SAHOME with the Spamassassin home directory:
8: start spamassassin
Configuring Postfix
9: Open Postfix config file using:
10: Find the the line
11 End of the file add:
12: restart postfix
Configuring Spamassassin
13: Open the Spamassassin default rules file using:
14 : make rules
15: now restart spamassassin
1: Use apt-get to install Spamassassin and spamc.
Code:
apt-get install spamassassin spamc
2: First add the group spams:
Code:
groupadd spamd
3: Then add the user spamd with the home irectory /var/log/spamassassin:
Code:
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
4: then create the directory /var/log/spamassassin and change the ownership:
Code:
mkdir /var/log/spamassassin
chown spamd:spamd /var/log/spamassassin
Setting Up Spamassassin
5: Open the spamassassin config file using:
Code:
nano /etc/default/spamassassin
6: Setting up spamassassin
Code:
Find ENABLED=0 and change to ENABLED=1
Find CRON=0 and change to CRON=1
Find OPTIONS and change the line to
OPTIONS="--create-prefs --max-children 2 --username spamd \ -H ${SAHOME} -s ${SAHOME}spamd.log"
7: Now create a variable named SAHOME with the Spamassassin home directory:
Code:
SAHOME="/var/log/spamassassin/"
8: start spamassassin
Code:
service spamassassin start
Configuring Postfix
9: Open Postfix config file using:
Code:
nano /etc/postfix/master.cf
10: Find the the line
Code:
smtp inet n - - - - smtpd
add "-o content_filter=spamassassin" after smtpd
11 End of the file add:
Code:
spamassassin unix - n n - - pipe user=spamd argv=/usr/bin/spamc -f -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
12: restart postfix
Code:
service postfix restart
Configuring Spamassassin
13: Open the Spamassassin default rules file using:
Code:
nano /etc/spamassassin/local.cf
14 : make rules
Code:
change
Subject ***** SPAM ***** to
rewrite_header Subject [*** SPAM ***]
change required_score 5.0 to required_score 3.0
use_bayes from 0 to 1
bayes_auto_learn from 0 to 1
15: now restart spamassassin
Code:
service spamassassin restart