This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Ubuntu :How to setup Spamassassin
#1
Ubuntu :How to setup Spamassassin
How to setup Spamassassin

1: Use apt-get to install Spamassassin and spamc.
Code:
apt-get install spamassassin spamc
Add Spamassassin user

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"
save and exit

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
#rewrite_header
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
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by: kellenw , lino69 , rafaht , fairbanksk , Bobses , ashok , hayden29
#2
RE: Ubuntu :How to setup Spamassassin
Very cool Diablo925. We'll get that added to our docs site once it's up and running!
Reply
Thanks given by:
#3
RE: Ubuntu :How to setup Spamassassin
Thanks Diablo925, excellent tutorial Smile - Like Sam has said, we'll get this added to our public documents repository as soon as it is live Smile

Cheers,
Bobby
Follow me on Twitter or find out more about me  at bobbyallen.me
Reply
Thanks given by:
#4
RE: Ubuntu :How to setup Spamassassin
Good job Smile Same for CentOS? didnt use this before.
Reply
Thanks given by:
#5
RE: Ubuntu :How to setup Spamassassin
HI,

I made (hacked from acid) this script up some time ago to Install PostGrey & Spamassassin for zPanel on Ubuntu 12.04 - I would assume it will work ok with Sentora looking at the tutorial - anyone interested please feel free to give it a go and let me know.

As will all scripts - please take care and backup!

Code:
#!/bin/sh
#
# Script to install postgrey and spamassassin on Ubuntu ZPanel system, arrogantly hacked from Centos 6.4 and ZPanel 10.1.0 script by acid
#
# Designed for ZPanel 10.1.1 & Ubuntu 12.04LTS
#
# Version 1
#
if which postgrey >/dev/null; then
echo "postgrey already exist"
else
echo "Installing postgrey"
apt-get -y install postgrey
sed -i '/^smtpd_recipient_restrictions =/ s/$/ check_policy_service inet:127.0.0.1:10023,/' /etc/zpanel/configs/postfix/main.cf
sed -i 's/POSTGREY_OPTS=\"--inet=10023"/POSTGREY_OPTS=\"--inet=127.0.0.1:10023 --delay=150\"/g' /etc/default/postgrey
service postgrey start
service postfix reload
chkconfig postgrey on
echo "postgrey installed"
fi
# Install Spamassassin
if which spamassassin >/dev/null; then
echo "spamassassin already exist"
else
echo "Installing spamassassin"
apt-get -y install spamassassin spamc
# Enable
sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/spamassassin
# Set Home Directory
sed -i '/OPTIONS=/i \SAHOME="/var/log/spamassassin/"' /etc/default/spamassassin
# Set Options inc log
sed -i 's/OPTIONS="--create-prefs --max-children 5 --helper-home-dir"/OPTIONS="--create-prefs --max-children 2 --username spamd --helper-home-dir ${SAHOME} -s ${SAHOME}spamd.log"/g' /etc/default/spamassassin
# Setup sa user account
groupadd spamd
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
mkdir /var/log/spamassassin
chown spamd:spamd /var/log/spamassassin
# Edit local file
sed -i '1s/^/required_hits 5.0\n/' /etc/spamassassin/local.cf
sed -i '2s/^/report_safe 0\n/' /etc/spamassassin/local.cf
sed -i '3s/^/required_score 5\n/' /etc/spamassassin/local.cf
sed -i '4s/^/rewrite_header Subject ***SPAM***\n/' /etc/spamassassin/local.cf
# Update postfix master.cf
sed -i '/^smtp        inet/ s/$/ -o content_filter=spamassassin/' /etc/zpanel/configs/postfix/master.cf
sed -i '/^smtp      inet/ s/$/ -o content_filter=spamassassin/' /etc/zpanel/configs/postfix/master.cf
sed -i '/^smtp    inet/ s/$/ -o content_filter=spamassassin/' /etc/zpanel/configs/postfix/master.cf
sed -i '/^smtp  inet/ s/$/ -o content_filter=spamassassin/' /etc/zpanel/configs/postfix/master.cf
echo "\nspamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f \${sender} \${recipient}\n" >> /etc/zpanel/configs/postfix/master.cf
service postfix restart
service spamassassin restart
echo "SpamAssassin installed, to test it send a mail from outside with the subject: XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X"
echo "Your first email will take about 150 seconds to arrive"
fi

I hope it is of some help.
Reply
Thanks given by:
#6
RE: Ubuntu :How to setup Spamassassin
I've personally just installed this on Ubuntu 14.04 LTS running Sentora 1.0.0 and appears to be working fine! (I didn't use the above script but used the steps provided by Diablo at the top of this thread!)

Thanks for the guide Diablo - Maybe we should look at adding this as part of the main installer Wink
Follow me on Twitter or find out more about me  at bobbyallen.me
Reply
Thanks given by:
#7
RE: Ubuntu :How to setup Spamassassin
(02-02-2015, 10:44 PM)ballen Wrote: I've personally just installed this on Ubuntu 14.04 LTS running Sentora 1.0.0 and appears to be working fine! (I didn't use the above script but used the steps provided by Diablo at the top of this thread!)

Thanks for the guide Diablo - Maybe we should look at adding this as part of the main installer Wink

I will be happy to beef up postfix layer in next release.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask
Freelance AWS Certified Architect & SysOps// DevOps

10$ free to start your VPS
Reply
Thanks given by:
#8
RE: Ubuntu :How to setup Spamassassin
Quote:I will be happy to beef up postfix layer in next release.


M B

Cool, I'll add this to the Roadmap then Wink
Follow me on Twitter or find out more about me  at bobbyallen.me
Reply
Thanks given by:
#9
RE: Ubuntu :How to setup Spamassassin
i am happy it still works ;D
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by:
#10
RE: Ubuntu :How to setup Spamassassin
(02-02-2015, 11:29 PM)ballen Wrote:
Quote:I will be happy to beef up postfix layer in next release.


M B

Cool, I'll add this to the Roadmap then Wink

(02-03-2015, 01:50 AM)Diablo925 Wrote: i am happy it still works ;D

Hi,

How do we check if items on roadmaps are implemented? Is there a flowchart/progress tracker somewhere?
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Upgrade to Ubuntu 16.04 from 14.04 HogensHero 8 27 ,049 07-18-2020, 03:13 AM
Last Post: dycott78
Ubuntu: How to Enable tls/ssl in proftpd Diablo925 2 11 ,675 04-21-2020, 03:35 AM
Last Post: iraqiboy90
Ubuntu 18.04 or 20.04 Kangarooo 1 6 ,057 03-20-2020, 11:39 AM
Last Post: Jettaman

Forum Jump:


Users browsing this thread: 1 Guest(s)