Sunday, March 2, 2008

Enabling Spam Assassin in Plesk

Enabling spam assassin in plesk 6 is quite simple. In the latest plesk 7 it is inbuilt in control panel but in Plesk 6 it is to be ebabled from shell.

This can be done by modifying the /etc/mail/spamassassin/local.cf file by adding the line :

blacklist_to anything@__mydomain__.com

Here the mailboxes which get spam mails are to be provided and not the mail addresses from which the mails are comming. Then just restart the spamd service by : service spamd restart

But I was not able to find the exact method how this works(but it definitely works) i.e. does it block the mails if they come more than say 10 mails per hour ?
=====================================================================================
Another way to stop spam mails is by using IPTABLES rules. Please follow the steps : look at one of the emails...

in the headers, it will show stuff kind like this.


--------------------------------------------------------------------------------
Received: (qmail 5419 invoked by uid 2520); 23 May 2004 23:55:57 -0000
Received: from jerry@the-escape.org by air291.startdedicated.com by uid 2020 with qmail-scanner-1.20st
(clamuko: 0.71. spamassassin: 2.63. Clear:RC:1(68.162.126.87):.
Processed in 0.050185 secs); 23 May 2004 23:55:57 -0000
Received: from pool-68-162----.phil.east.verizon.net (HELO laptop) (68.162.255.255)
by www.the-escape.org with SMTP; 23 May 2004 23:55:56 -0000
--------------------------------------------------------------------------------
in this case, the email server has the hostname of www.the-escape.org. look for where your server receives the email. there will probably be a few more "Received:" lines lower in the email.

use the IP address in the ( ) as the address to block. so, if you wanted to block this IP address, you would log into your server via ssh and perform this command.

code:
--------------------------------------------------------------------------------
iptables -A INPUT -s 68.162.255.255 --dport 25 -j REJECT
--------------------------------------------------------------------------------
iptables is a program that allows you to manage the server firewall.
You can also use netmasks like this:

iptables -A INPUT -s 222.64.0.0/16 --dport 25 -j REJECT

the above would block a big part of CHINA.

No comments: