HOW TO PROTECT YOUR SERVER FROM DDOS ATTACK

Before to start, I would describe what is DDOS attack

On the Internet, a distributed denial-of-service (DDoS) attack is one in which a multitude of compromised systems attack a single target, thereby causing denial of service for users of the targeted system.

The flood of incoming messages to the target system essentially forces it to shut down, thereby denying service to the system to legitimate users.

I am writing a perl script which prevent this problem.

First do the Installation of a simple perl script: run this for script for installation.

#!/bin/sh
 if [ -d '/usr/local/ddos' ]; then
 echo; echo; echo "Please un-install the previous version first"
 exit 0
 else
 mkdir /usr/local/ddos
 fi
 clear
 echo; echo 'Installing DOS-Deflate 0.6'; echo
 echo; echo -n 'Downloading source files...'
 wget -q -O /usr/local/ddos/ddos.conf http://www.inetbase.com/scripts/ddos/ddos.conf
 echo -n '.'
 wget -q -O /usr/local/ddos/LICENSE http://www.inetbase.com/scripts/ddos/LICENSE
 echo -n '.'
 wget -q -O /usr/local/ddos/ignore.ip.list http://www.inetbase.com/scripts/ddos/ignore.ip.list
 echo -n '.'
 wget -q -O /usr/local/ddos/ddos.sh http://www.inetbase.com/scripts/ddos/ddos.sh
 chmod 0755 /usr/local/ddos/ddos.sh
 cp -s /usr/local/ddos/ddos.sh /usr/local/sbin/ddos
 echo '...done'

echo; echo -n 'Creating cron to run script every minute.....(Default setting)'
 /usr/local/ddos/ddos.sh --cron > /dev/null 2>&1
 echo '.....done'
 echo; echo 'Installation has completed.'
 echo 'Config file is at /usr/local/ddos/ddos.conf'
 echo 'Please send in your comments and/or suggestions to zaf@vsnl.com'
 echo
 cat /usr/local/ddos/LICENSE | less

Copy this script into file and save this it with name install.sh. Then:

# chmod 0700 install.sh

./install.sh

For uninstalling, run this script:

#!/bin/sh
 echo; echo "Uninstalling DOS-Deflate"
 echo; echo; echo -n "Deleting script files....."
 if [ -e '/usr/local/sbin/ddos' ]; then
 rm -f /usr/local/sbin/ddos
 echo -n ".."
 fi
 if [ -d '/usr/local/ddos' ]; then
 rm -rf /usr/local/ddos
 echo -n ".."
 fi
 echo "done"
 echo; echo -n "Deleting cron job....."
 if [ -e '/etc/cron.d/ddos.cron' ]; then
 rm -f /etc/cron.d/ddos.cron
 echo -n ".."
 fi
 echo "done"
 echo; echo "Uninstall Complete"; echo

 

Taggato su: ,
Loading Facebook Comments ...

Lascia un commento