ModSecurity is an open source intrusion detection and prevention engine for web applications. It operates embedded into the web server, acting as a powerful umbrella - shielding applications from attacks. ModSecurity supports both branches of the Apache web server.
This HOW-TO is for Apache 2.X only.
cd /usr/local/src
mkdir modsecurity2
cd modsecurity2
wget http://www.serverbuddies.com/files/modsecurity-apache_2.5.9.tar.gz
perl -pi -e ’s/ServerTokens Major/ServerTokens Full/’ /etc/httpd/conf/extra/httpd-default.conf
perl -pi -e ’s/ServerSignature Off/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf
perl -pi -e ’s/ServerSignature EMail/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf
tar xzf modsecurity-apache_2.5.9.tar.gz
cd modsecurity-apache_2.5.9
cd apache2
./configure
make
make test
make install
Now we download a pre-defined mod_sec ruleset,
cd /etc/modsecurity2/
wget http://www.serverbuddies.com/files/modsec.v2.rules.conf
Add the new compiled mod_security module into the apache configuration,
vi /etc/httpd/conf/httpd.conf
After:
LoadModule php5_module /usr/lib/apache/libphp5.so
Add:
For 32bit -
LoadFile /usr/lib/libxml2.so
LoadModule security2_module /usr/lib/apache/mod_security2.so
For 64bit -
LoadFile /usr/lib64/libxml2.so
LoadModule security2_module /usr/lib/apache/mod_security2.so
At the botton of the httpd.conf config file we add the following,
# ModSecurity2 config file.
Include /etc/modsecurity2/modsec.v2.rules.conf
Restart the webserver.
service httpd restart
Installation should be completed and mod_sec should be now loaded on your Apache webserver.
# ModSecurity2 config file.
Include /etc/modsecurity2/modsec.v2.rules.conf
Restart the webserver.
service httpd restart
Installation should be completed and mod_sec should be now loaded on your Apache webserver.
No comments:
Post a Comment