Come ostruire gli attacchi di DDOS in Linux

da Sukrit Dhandhania su 13 aprile 2009

Linux Sicurezza

Abbiamo fatto funzionare un articolo sopra Come ostruire un IP address nei iptables in Linux alcuni giorni fa. Qui è un articolo gratuito che le esposizioni voi come rilevare gli indirizzi del IP dei attackers nel caso dell'una smentita di servizio (o del DOS) attacano.

Per fare questo useremo il software libero denominato psad. psad impianti nella sincronizzazione con i iptables ed i video che i iptables annota e che controlla per vedere se c'è le esplorazioni port e l'altro traffico sospettoso che sono solitamente segni di qualcuno che prova a rompersi nel vostro assistente di Linux.

Per cominciare, installi lo psad. Se state funzionando un sapore di Linux che ha un sistema di amministrazione operato del pacchetto come Ubuntu o Fedora voi dovrebbe potere usare uno di seguenti ordini ottenere lo psad sul vostro sistema:

il sudo del # adatto-ottiene installa lo psad
o
il yum del # installa lo psad

Se questo non funziona per voi la testa allo psad pagina di trasferimento dal sistema centrale verso i satelliti e trasferisca la disposizione dal sistema centrale verso i satelliti che funziona per voi.

Poichè utilizzo un assistente di Ubuntu Linux il resto di questa lezione privata sarà Ubuntu specifico. Tuttavia, con un certo minore tweaking dovrebbero potere rendergli il lavoro su altri sapori di Linux. Apra syslog.conf lima con il vostro sistema di editazione testi favorito:

# vim /etc/syslog.conf

Aggiunga la seguente linea alla conclusione del della lima:

kern.info |/var/lib/psad/psadfifo

Potete usare il seguente ordine compire la stessa cosa:

eco del # - e “kern.info \ t|/var/lib/psad/psadfifo„ >> /etc/syslog.conf

Ora ricominci sysklogd e klog daemons:

riavviamento di /etc/init.d/sysklogd
riavviamento di /etc/init.d/klogd

Gli impianti dello psad di senso è che rileverà ed insegnerà ai iptables per ostruire qualsiasi IPS sospettoso. A volte questo potrebbe provocare ostruire di un IP che usate. Per sormontare questa edizione dovreste generare una lima che contiene una lista degli indirizzi sicuri del IP. Generi una lima come questa:

# vim /home/calvin/safeiplist.cfg

Entri negli indirizzi del IP che avete bisogno dello psad al whitelist:

127.0.0.0 /24
192.168.0.0 /24
122.164.34.240

Nessun uso uno scritto come quanto segue uno per configurare i iptables con le regole necessarie. Nota che questo scritto rimuoverà tutte le regolazioni precedenti dalla vostra messa a punto dei iptables. Il copy ed incolla il seguente scritto sul vostro assistente di Linux e sostituisce le variabili WORKDIR e SAFEIPLIST con le regolazioni corrette dalla vostra messa a punto.

WORKDIR= " /home/calvin/ “
INTERVAL= " 5 "
HITCOUNT= " 5 "
SAFEIPLIST= " safeiplist.cfg "

Cd $WORKDIR

iptables - F
se [- f $SAFEIPLIST]; allora
IPS=$ (grep - Ev “^#„ $SAFEIPLIST)
per la i in $IPS
[[do]]
iptables - UN INPUT - s $i - J ACCETTA
fatto
fi

i iptables - UN INPUT - m. dichiarano - dichiari NUOVO - la m. recente - insieme
iptables -A INPUT -m state –state NEW -m recent –update –seconds $INTERVAL –hitcount $HITCOUNT -j LOG

What the script does is that it logs an IP address if it makes five or more attempts at making a connection in the span of five seconds. I would suggest you use the script as is unless you know what you are doing while modifying it. One you are done, give it executable permissions and run it.

# chmod +x /home/calvin/ipblock.sh

# /home/calvin/ipblock.sh

Now back to psad. Open the psad configuration file and edit it. These are the changes I suggest you make. Feel free to go through the psad documentation and make other changes:

EMAIL_ADDRESSES you@yourdomain.com;

Set machine’s hostname:

HOSTNAME yourdomain.com;

If you have only one network interface on this server, set HOME_NET to:

HOME_NET NOT_USED;

You can also need to adjust danger levels for psad, and define a set of ports to ignore, for example to ask psad ignore udp ports 80 and 8080, make the following change:

IGNORE_PORTS udp/80, udp/8080;

Save and close the file. Then restart psad:

# /etc/init.d/psad restart

You are now good to go. To monitor psad’s reports run the following command:

# psad -S

To remove automatically clocked IPs run the following command:

# psad -F

psad is a very versatile and powerful tool. If you know how to use it it can do wonders for you, but if you don’t you can really mess up your computer. So please use psad with caution.

Related Posts:
  • How to block an IP address in IPTables in Linux
  • Comcast: Another chapter of lies, misdirection and ps. good luck using bittorrent
  • How to determine where all your hard drive space has gone in Windows
  • Getting started with iptables in Linux
  • An introduction to the sudo command and configuration file
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.

    { 0 comments… add one now }

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>