Mod_Security is a great module for Apache 2 which adds many new security features and fixes a number of exploits. It’s also quite easy to install.
- ModSecurity 2.x works only with Apache 2.0.x or higher. Version 2.2.x is highly recommended
- Make sure you have mod_unique_id installed
mod_unique_id is packaged with Apache httpd
- libapr and libapr-util
- liblua v5.1.x
This library is optional and only needed if you will be using the new Lua engine.
Note that ModSecurity requires the dynamic libraries. These are not built by default in the source distribution, so the binary distribution is recommended
- libcurl v7.15.1 or higher
If you will be using the ModSecurity Log Collector (mlogc) to send audit logs to a central repository, then you will also need the curl library.
mkdir /root/modsec_tmp;cd /root/modsec_tmp wget http://www.modsecurity.org/download/modsecurity-apache_2.5.12.tar.gz tar -xvzf modsecurity-apache_2.5.12.tar.gz cd modsecurity-apache_2.5.12.tar.gz/apache2 ./configure --with-apxs=/opt/httpd/bin/apxs make make install
Mod_Security is now compiled as a module, but not enabled. To do that, we’ll have to add this to the Apache config file (Which we haven’t made yet).
# You may need to include these files first LoadFile /usr/lib/libxml2.so LoadFile /usr/lib/liblua5.1.so # Load the module with LoadModule security2_module modules/mod_security2.so
LAMP Server Setup Pt. 1 – Installing Apache HTTP Server
LAMP Server Setup Pt. 3 – Installing Mod_Chroot
LAMP Server Setup Pt. 4 – Installing PHP
LAMP Server Setup Pt. 5 – Configuring Apache