ispCP - Board - Support
Howto mod_security en apache2 - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega International Area (/forum-22.html)
+--- Forum: Spanish Corner (/forum-29.html)
+--- Thread: Howto mod_security en apache2 (/thread-6323.html)



Howto mod_security en apache2 - shiizpa - 04-07-2009 03:36 AM

ModSecurity es un módulo de Apache que proporciona detección de intrusos y la prevención de las aplicaciones web. Su objetivo es la protección de aplicaciones web de ataques conocidos y desconocidos, tales como ataques de inyección SQL, cross-site scripting, ataques vía transversal, etc.

Antes en las Response Headers
Code:
Server: apache2.11(debian) mod_fastcgi/2.4.6

Ahora
Code:
Server: Microsoft-IIS/7.0 mod_fastcgi/2.4.6

1. Agragamos las source segun nuestra distribucion de debian
Code:
nano /etc/apt/sources.list

PHP Code:
#Packages for Sid:
deb http://etc.inittab.org/~agi/debian/libapache-mod-security2 ./

#Packages for Etch are in etch/
deb http://etc.inittab.org/~agi/debian/libapache-mod-security2/etch ./

#Packages for Sarge (apache2.0) are in sarge/
deb http://etc.inittab.org/~agi/debian/libapache-mod-security2/sarge ./ 

2. Actualizamos las listas
Code:
apt-get update

3.Instalamos el mod
Code:
apt-get install libapache2-mod-security2

4.Configuración
Code:
nano /etc/apache2/apache2.conf

Agregamos esto al final de apache2.con antes de "# Include the virtual host configurations:"

PHP Code:
[...]
ServerTokens Full
SecServerSignature 
"Microsoft-IIS/5.0" #Pueden colocar cualquir nombre aca 
<IfModule mod_security2.c>
    
# Basic configuration options
    
SecRuleEngine On
    SecRequestBodyAccess On
    SecResponseBodyAccess Off

    
# Handling of file uploads
    # TODO Choose a folder private to Apache.
    # SecUploadDir /opt/apache-frontend/tmp/
    
SecUploadKeepFiles Off

    
# Debug log
    
SecDebugLog /var/log/apache2/modsec_debug.log
    SecDebugLogLevel 0

    
# Serial audit log
    
SecAuditEngine RelevantOnly
    SecAuditLogRelevantStatus 
^5
    SecAuditLogParts ABIFHZ
    SecAuditLogType Serial
    SecAuditLog 
/var/log/apache2/modsec_audit.log

    
# Maximum request body size we will
    # accept for buffering
    
SecRequestBodyLimit 131072

    
# Store up to 128 KB in memory
    
SecRequestBodyInMemoryLimit 131072

    
# Buffer response bodies of up to
    # 512 KB in length
    
SecResponseBodyLimit 524288

</IfModule>

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled

y ya estamos listos para reiniciar nuestro apache

Code:
/etc/init.d/apache2 restart

y ahora a disfrutar de nuestro apache mucho mas seguro probado y funcionando en debian lenny!!



RE: Howto mod_security en apache2 - rbravo - 05-13-2009 04:14 AM

Ya está en la rama testing y sid ;-)