Homebase Profiles User Control Panel FastNav
               

Vai indietro   CStrike.iT > Diverse > Mac Linux Windows > Tutoriale
Forum Group @ Facebook


Rispondi
 
LinkBack Strumenti discussione Modalità visualizzazione
  #1  
Vecchio 10-24-2011, 16:38
L'avatar di r00t
Founder/CEO
Points: 14246, Level: 12
Activity: 99.7%
Users Flag!
 
Data registrazione: Nov 2002
Località: localhost
Messaggi: 798
Tournaments Joined: 3
Tournaments Won: 0
Thanks: 92
Thanked 138 Times in 92 Posts
Shop User owns 3x M4A1 User owns 2x AK47 User owns 4x Sniper Soldier

Awards Showcase
Tifoso AS Roma 
Total Awards: 1


Mood
Approved

Predefinito [Linux] Installing automatic protection from DoS and DDoS attacks to your server

DDoS-Deflate

DDoS-Deflate is a couple of bash scripts, that is run every X minutes, analyze the total number of connections to your server from every IP address using netstats command and temporarily blacklist IPs, that have more than Y active connections to your server at the moment, script runs. Blacklisting is done using either iptables or APF whichever you have installed. Simple!

Installation

To install ddos protection scripts just execute the following commands from console:


Codice:
cd /usr/local
mkdir mytmp
cd mytmp
wget http://www.cstrike.it/linux/install-ddos.sh
chmod +x install-ddos.sh
./install-ddos.sh
Configuration

To configure DDOS-Deflate (that’s the name of this script) do the following:


Codice:
cd /usr/local/ddos
nano ddos.conf
Last line opens ddos.conf file in editor. You can use vi if you like. I chose edit because I am a Windows user and Edit has an interface familiar to me.
Let’s consider all available settings one by one:

Codice:
PROGDIR="/usr/local/ddos" 
PROG="/usr/local/ddos/ddos.sh" 
IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list" 
CRON="/etc/cron.d/ddos.cron" 
APF="/etc/apf/apf" 
IPT="/sbin/iptables"
These above are about various software locations. I recommend you leave them as is. They should suite the majority of systems. BTW, if your system doesn’t have APF, it is ok. Script can work with iptables also.

Codice:
FREQ=1
This setting affects how often (in minutes) you need to execute ddos protection script. After changing this param, please execute command


Codice:
ddos –cron
to update cron sheduler.
Codice:
NO_OF_CONNECTIONS=150
This is the maximum number of connections acceptable for your server. I recommend to set this value to about 20-40 depending on your server.
BTW, don’t repeat my mistake Click the image to open in full size. Should you decide to use softwares, that open really many connections to your server, like FileZilla FTP client (it spawns many FTP connections to upload your folder ASAP), you will get blocked Click the image to open in full size.


Codice:
APF_BAN=1
If you have AFP, then set this to 1. If you have not, script will use iptables. To check if you have AFP or not, just execute command

Codice:
afp
If you want to use IPTables, don’t forget to start service by


Codice:
service iptables start
and to have it autoloading at system startup by

Codice:
chkconfig iptables on
Codice:
KILL=1
If you just testing your script, set this to 0. In this case, IPs will not get banned.

Codice:
EMAIL_TO="root"
This email address will have messages about blacklisted IPs. Leave it to root to skip emailing.

Codice:
BAN_PERIOD=600
Set this to a number of seconds, for how long to block entruder. I recommend to set this to 1800-3600 (30-60 minutes).
You can also add IPs to /usr/local/ddos/ignore.ip.list to whitelist them.

Uninstallation

You can always uninstall DDoS-Deflate by executing

Codice:
cd /usr/local/mytmp
wget http://www.cstrike.it/linux/uninstall.ddos
chmod +x uninstall.ddos
./uninstall.ddos


YAY! I'VE GOT RAINBOW COLOR SIGNATURE CRAP

Rispondi citando Share on facebook

CStrike.iT
Rispondi

Tag
attacks, automatic, ddos, dos, installing, linux, protection, server

CStrike.iT

Strumenti discussione
Modalità visualizzazione

Regole di scrittura
Tu non puoi inviare nuove discussioni
Tu non puoi inviare risposte
Tu non puoi inviare allegati
Tu non puoi modificare i tuoi messaggi

Il codice BB è Attivo/e
Faccine sono Attivo/e
Il codice [IMG] è Attivo/e
Il codice HTML è disattivato
Trackbacks are Attivo/e
Pingbacks are Attivo/e
Refbacks are Attivo/e



Tutti gli orari sono GMT +2. Adesso sono le 18:00.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0
Copyright ©2002 - 2010, CStrike.iT

CStrike.iT tested by McAfee Security CStrike.iT tested by McAfee Security

This site is optimized for 1280x1024 screen resolution and works best with Firefox