No more spam (Centos and postfix)

So i HATE spam and now to get rid of as so many as possible i go for 3 step.

1. Postfix 

Get postfix to restrict witch is to allow to send email to me.
No strange name and use spam block lists. Also restrict time in how many connections you can do.

2. Greylisting

So the first time some server tries to send email greylist says no resend that email.
all propper config servers will resind the email. But spamservers will not.

3. Run spam filter on the email still passing

Install packages

yum install spamassassin postgrey

some bash server settings

sudo groupadd spamd
sudo useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
sudo chown spamd:spamd /var/log/spamassassin
nano /etc/mail/spamassassin/local.cf
required_hits 5.0
report_safe 0
required_score 5
rewrite_header Subject ***SPAM***
sudo nano /etc/postfix/master.cf

In the end of the file add this

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

add this in the file /etc/postfix/main.cf

#spam fighting
disable_vrfy_command = yes
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks,
reject_non_fqdn_hostname,
reject_invalid_hostname,
permit
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
check_policy_service unix:postgrey/socket,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unauth_destination,
reject_rbl_client list.dsbl.org,
reject_rbl_client sbl.spamhaus.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client dul.dnsbl.sorbs.net,
permit
smtpd_error_sleep_time = 1s
smtpd_soft_error_limit = 10
smtpd_hard_error_limit = 20
sa-update

restart postfix greylist and spamassassin and then you done

Read more here

http://www.rackspace.com/knowledge_center/article/installing-and-configuring-spamassassin-on-centos

http://wiki.centos.org/HowTos/postgrey

http://www.cyberciti.biz/tips/postfix-spam-filtering-with-blacklists-howto.html

 

Leave a Reply

%d bloggers like this: