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.

Centos 7 : Setup Spamassassin
#1
Centos 7 : Setup Spamassassin
All steps that described bellow, tested and working on Centos 7 Vps + Sentora 1.0.0

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
You have to add the following lines, if already there just uncoment #
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
About line 11 in top add after smtpd
Code:
-o content_filter=spamassassin
Full line looks like that
Code:
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
And the end - bottom add
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
On roundcube webmail it will be marked as spam.

Test spam message to see if it works : http://spamassassin.apache.org/gtube/
Reply
Thanks given by: mostafiz , poudenes
#2
RE: Centos 7 : Setup Spamassassin
Thank you so mutch for this! But when i add the 2 lines to the master.cfg i dont getty any mail anymore.
Reply
Thanks given by:
#3
RE: Centos 7 : Setup Spamassassin
(02-24-2015, 09:07 PM)Smile Wrote: Thank you so mutch for this! But when i add the 2 lines to the master.cfg i dont getty any mail anymore.

On master.cf on line 11 default is
Code:
smtp      inet  n       -       n       -       -       smtpd

After modification must be like this
Code:
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin

Also carefully on the end of master.cf add line
Code:
spamassassin unix - n n - - pipe flags=R user=spamd argv=/usr/bin/spamc -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}

Double check all lines - steps and dont forget to restart services!!!
Reply
Thanks given by:
#4
RE: Centos 7 : Setup Spamassassin
its work good
Reply
Thanks given by:
#5
RE: Centos 7 : Setup Spamassassin
Maybe add systemctl enable spamassassin in your tut.
[Image: logo2.png]

My being on this forum is all personal and all is done here by me has nothing to with the company Web Improved I work for Smile
Reply
Thanks given by:
#6
RE: Centos 7 : Setup Spamassassin
After following this tut, everything runs and works.  However, while running spamassassin, my cpu is hitting 100% all the time.  spamd is guilty according to top.  

Any suggestions would be appreciated.

Thanks,

John
Reply
Thanks given by:
#7
RE: Centos 7 : Setup Spamassassin
I know this is not what you want to hear... But, this is not a Sentora issue. I suggest checking spamassassin site or searching on Google or whatever search you use.
Many others with same issue apparently:
https://www.google.com/search?q=spamassa...8&oe=utf-8

Please post back a solution that worked for you to help other Wink Thanks!
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#8
RE: Centos 7 : Setup Spamassassin
(02-23-2015, 07:32 AM)Untouchable Wrote: All steps that described bellow, tested and working on Centos 7 Vps + Sentora 1.0.0

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
You have to add the following lines, if already there just uncoment #
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
About line 11 in top add after smtpd
Code:
-o content_filter=spamassassin
Full line looks like that
Code:
smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
And the end - bottom add
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
On roundcube webmail it will be marked as spam.

Test spam message to see if it works : http://spamassassin.apache.org/gtube/

hello,
I have followed above steps and i believe, setup is done. However i dont see the serve enabled on my services tab on VPS. what could b the reason?
Below is what i see after point 8, is this correct? please advise, thanks
=================
[root@mail ~]# ss -tnlp | grep spamd
LISTEN 0 128 127.0.0.1:783 *:* usersSad("spamd child",3319,5),("spamd child",3318,5),(" /usr/bin/spamd ",3317,5))
LISTEN 0 128 ::1:783 :::* usersSad("spamd child",3319,6),("spamd child",3318,6),(" /usr/bin/spamd ",3317,6))
=============================================
thanks
Reply
Thanks given by:
#9
RE: Centos 7 : Setup Spamassassin
Hi, this doesn't seem to include Bayesian filtering using mysql db or moving spam directly to junk folder. Also we should consider automating all this as part of sentora installation?
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Fail2ban for Sentora (Centos 7) bbspike 14 48 ,677 01-14-2020, 07:32 AM
Last Post: Vedran B
[How To] Update from PHP v5.4.16 to v5.6.31 (Includes suhosin patch) [CentOS] betatester3.0 5 19 ,358 03-18-2019, 01:23 AM
Last Post: BigBang
Ubuntu: How to setup TLS on postfix and dovecot Diablo925 28 116 ,126 02-15-2018, 08:46 PM
Last Post: duane

Forum Jump:


Users browsing this thread: 1 Guest(s)