STOP Slowloris Attack on Apache running on CentOS
Slowloris HTTP DoS: A new and dangerous exploit out there for the apache server.
“Slowloris holds connections open by sending partial HTTP requests. It continues to send subsequent headers at regular intervals to keep the sockets from closing. In this way webservers can be quickly tied up.”
In essence you can send a Denial Of Service attack to website using one laptop over a proxy.
Here will be a way of preventing the slowloris attack on apache 2.2.3 server running on centos 5.3
cd tmp/
wget http://downloads.sourceforge.net/project/mod-qos/mod-qos/8.13/mod_qos-8.13-src.tar.gz?use_mirror=hivelocity
tar xvfz mod_qos-8.13-src.tar.gz
cd mod_qos-8.13/apache2
apxs -i -c mod_qos.c (if you do not have apxs then you have to yum install httpd-devel and make sure you edit out the exclude updates to httpd in your yum.conf file)
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.
———————————————————————-
chmod 755 /usr/lib/httpd/modules/mod_qos.so
cd etc/httpd/conf
nano qos.conf
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>
save it
edit httpd.conf
and add