LAMP Server Setup Pt. 2

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.

Installation Requirements

  • 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
    http://apr.apache.org/
  • libpcre
    http://www.pcre.org/
  • libxml2
    http://xmlsoft.org/downloads.html
  • liblua v5.1.x
    This library is optional and only needed if you will be using the new Lua engine.
    http://www.lua.org/download.html

    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.
    http://curl.haxx.se/libcurl/
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

2 Replies to “LAMP Server Setup Pt. 2”

  1. […] Server Setup Pt. 1 – Installing Apache HTTP Server LAMP Server Setup Pt. 2 – Installing Mod_Security LAMP Server Setup Pt. 3 – Installing Mod_Chroot LAMP Server Setup Pt. 4 – Installing […]

  2. […] LAMP Server Setup Pt. 2 – Installing Mod_Security LAMP Server Setup Pt. 3 – Installing Mod_Chroot LAMP Server Setup Pt. 4 – Installing PHP LAMP Server Setup Pt. 5 – Configuring Apache […]

Leave a Reply