07déc.2009
Compilation Installation et Configuration de mod_qos

Défendre son indien
http://www.howtoforge.com/how-to-defend-slowloris-ddos-with-mod_qos-apache2-on-debian-lenny
Url Site officiel : http://mod-qos.sourceforge.net/
Téléchargement :
cd /opt/SOURCES wget http://downloads.sourceforge.net/project/mod-qos/mod-qos/9.1/mod_qos-9.1-src.tar.gz?use_mirror=freefr tar xvzf mod_qos-9.1-src.tar.gz cd mod_qos-9.1
Pre-requis :
- httpd-devel (c'est selon votre distribution et votre installation d'apache)
- pcre et pcre-devel
Installation :
Très simple.
cd apache2/ apxs -i -c mod_qos.c
Utilisez apxs2 si vous etes sous Debian ou Ubuntu.
Si tout ce deroule bien vous devriez avoir quelque chose comme ceci :
[...]
Libraries have been installed in:
/usr/lib/httpd/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Configuration :
Faites un locate sur mod_qos pour voir ou il se trouve et ajoutez quelque chose comme ce qui suit dans votre fichier de configuration d'apache :
LoadModule qos_module /opt/httpd2213/modules/mod_qos.so
Au prochain redémarrage de votre apache le module sera chargé.
Rajoutez aussi ceci, ce sont les parametres pour mod_qos :
## QoS Settings
<IfModule mod_qos.c>
# handles connections from up to 100000 different IPs
QS_ClientEntries 100000
# will allow only 50 connections per IP
QS_SrvMaxConnPerIP 50
# maximum number of active TCP connections is limited to 256
MaxClients 256
# disables keep-alive when 70% of the TCP connections are occupied:
QS_SrvMaxConnClose 180
# minimum request/response speed (deny slow clients blocking the server, ie. slowloris keeping connections open without requesting anything):
QS_SrvMinDataRate 150 1200
# and limit request header and body (carefull, that limits uploads and post requests too):
# LimitRequestFields 30
# QS_LimitRequestBody 102400
</IfModule>
Ajustez tout ça selon vos choix biensur.
Personnellement avec ce module j'obtiens de charmante chose dans mon fichier d'erreur log d'apache :
*** glibc detected *** /opt/httpd/bin/httpd: double free or corruption (!prev): 0x0000000000b0d4e0 ***
======= Backtrace: =========
/lib64/libc.so.60x3eedc722ef
/lib64/libc.so.6(cfree+0x4b)0x3eedc7273b
/usr/lib64/libapr-1.so.0(apr_allocator_destroy+0x1b)0x7f9a0051125b
/opt/httpd/bin/httpd0x4534ad
/opt/httpd/bin/httpd0x45400d
...
à creuser....

Commentaires
mardi, décembre 8 2009 | 10:05
Alors ? personne ne l'a testé ?
vendredi, décembre 25 2009 | 23:49
je l'aurai bien testé, mais ça fait un moins maintenant que les attaque ddos ont stoppé, fail2ban à calmé les attaquants ^^
mercredi, décembre 22 2010 | 22:37
Ce message est très pertinant à mon gout, c'est vraiment une réussite, félicitations.