Inetbase DDOS Koruma kurulumu ve Korunma

Şunu girelim:

wget http://www.inetbase.com/scripts/ddos/install.sh
sh install.sh

Kaldırmak için:

wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
sh uninstall.ddos

Ayarları:

nano /usr/local/ddos/ddos.conf

APF_BAN=0 1 apf ban, 0 iptables ban
NO_OF_CONNECTIONS=150 150 bağlantıdan sonra ban. 75 idealdir.
BAN_PERIOD=600 600 saniye (10) dakika. Üste göre 10 dakikada 150 bağlantıüstü ban
[email protected] mailimiz

APF’yi 0,
Ban periyotu, 3600 yapabiliriz.

Düzenlemekte fayda var:

netstat -tn --inet 2> /dev/null| grep ":80" | awk '/tcp[ ]*[0-9]+[ ]*[0-9]+[ ]+[^ ]+[ ]*[^ ]*/ { print $5; }' | cut -d":" -f1 | sort | uniq -c | sort -n

Mailinizi girdiğinizde büyük ihtimalle spam kutunuza şu şekilde mailler gelecektir:

Banned the following ip addresses on Fri Oct 14 15:21:01 MSD 2011
194 with 194 connections

iptables boşaltmak istersek:

iptables -F

Şöyle birşey de yapılabilir:

ddos.conf en altına gözardı edilecek ipler girilebilir:

PROTECTED_IPS=( "192.168.1.10" "127.0.0.1" "10.0.10.1" "192.168.1.5" )

Daha sonra ddos.sh içinde şu satırı bulalım:

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr > $BAD_IP_LIST

Bu satırı ve satırın altındakileri silip şunu ekleyelim:

BAD_SYN_IP_LIST=`$TMP_FILE`
netstat -np | grep SYN_RECV | awk '{print $5}' | cut -d: -f1 | cut -d: -f1 | sort | uniq -c | \
sort -n| awk '{if ($1 > 4) print $2;}' > $BAD_SYN_IP_LIST
cat $BAD_SYN_IP_LIST
while read SYN_IP; do
$IPT -I INPUT -s $SYN_IP -j DROP ;
echo $SYN_IP>> $BANNED_IP_LIST
echo $SYN_IP>> $IGNORE_IP_LIST
done < $BAD_SYN_IP_LIST #DDOS Bolumu netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr > $BAD_IP_LIST
cat $BAD_IP_LIST
if [ $KILL -eq 1 ]; then
IP_BAN_NOW=0
while read line; do
CURR_LINE_CONN=$(echo $line | cut -d" " -f1)
CURR_LINE_IP=$(echo $line | cut -d" " -f2)
if [ $CURR_LINE_CONN -lt $NO_OF_CONNECTIONS ]; then
break
fi
IGNORE_BAN=`grep -c $CURR_LINE_IP $IGNORE_IP_LIST`
if [ $IGNORE_BAN -ge 1 ]; then
continue
fi
IP_BAN_NOW=1
echo "$CURR_LINE_IP with $CURR_LINE_CONN connections" >> $BANNED_IP_MAIL
echo $CURR_LINE_IP >> $BANNED_IP_LIST
echo $CURR_LINE_IP >> $IGNORE_IP_LIST
if [ $APF_BAN -eq 1 ]; then
$APF -d $CURR_LINE_IP
else
NOT_PROTECTED=1
for u in "${PROTECTED_IPS[@]}"; do
if [ $CURR_LINE_IP = $u ]; then
NOT_PROTECTED=0
break
fi
done

if [ $NOT_PROTECTED -eq 1 && $CURR_LINE_IP != ""]; then
$IPT -I INPUT -s $CURR_LINE_IP -j DROP
fi

fi
done < $BAD_IP_LIST if [ $IP_BAN_NOW -eq 1 ]; then dt=`date` if [ $EMAIL_TO != "" ]; then cat $BANNED_IP_MAIL | mail -s "IP addresses banned on $dt" $EMAIL_TO fi unbanip fi fi rm -f $TMP_PREFIX.*

Ardarda 4 SYN talebi gönderen ip banlanır.

Bu yazı Bilgisayar kategorisine gönderilmiş. Kalıcı bağlantıyı yer imlerinize ekleyin.

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir