IndianWebPortal.com

Something Different In Linux

Home » cpanel » Stop spamming using iptables

Stop spamming using iptables

Posted by Rishikesh Vispute Categories: cpanel, security

You can stop the number of spammer  ip address to known spam ip addresses from spamhaus . org

vi /root/blockspamips.sh

=========================

#!/bin/bash
IPTABLES=/sbin/iptables
FILE="/tmp/drop.lasso"
URL="http://www.spamhaus.org/drop/drop.lasso"
#echo ""
#echo -n "Applying DROP list to existing firewall..."
$IPTABLES -D INPUT -j Spamhaus
$IPTABLES -D OUTPUT -j Spamhaus
$IPTABLES -D FORWARD -j Spamhaus
$IPTABLES -F Spamhaus
$IPTABLES -X Spamhaus
[ -f $FILE ] && /bin/rm -f $FILE || :
cd /tmp
wget $URL
blocks=$(cat $FILE | egrep -v '^;' | awk '{ print $1}')
$IPTABLES -N Spamhaus
for ipblock in $blocks
do
#$IPTABLES -A Spamhaus -s $ipblock -j LOG --log-prefix "DROP List Block"
$IPTABLES -A Spamhaus -s $ipblock -j DROP
#echo $ipblock
done
$IPTABLES -I INPUT -j Spamhaus
$IPTABLES -I OUTPUT -j Spamhaus
$IPTABLES -I FORWARD -j Spamhaus
#echo "...Done"
/bin/rm -f $FILE

=========================

Save the file

2) chmod +x /root/blockspamips.sh

3)  sh /root/blockspamips.sh

Done


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...