Introduction
This is designed to be a quick and easy installation for mod-security on Ubuntu 10.04 Server running LAMP.
For some strange reason none of the existing guides work quite right, and it just causes a boatload of problems due to the addition of .data files.
Prerequisites
- Ubuntu 10.04 LTS Server (This will likely work on other versions)
- LAMP stack (with Apache 2.2.x)
- subversion, automake, libtool, build-essential, apache2-threaded-dev, libxml2-dev, libcurl4-dev, libreadline5-dev, lua5.1, luarocks
- About 20 minutes
Satisfy Dependencies
| sudo apt-get install subversion automake libtool build-essential apache2-threaded-dev libxml2-dev libcurl4-dev libreadline5-dev lua5.1 luarocks |
Installing Mod-Security
This method involves downloading the latest version using subversion, however you can get a static download :
here*note : make sure you extract these files or the rest of the procedure probably won’t make sense
Step 1 : Downloading Mod Security (if you used the static download link above you don’t have to do this)
run the following
Step 2 : Building Mod Security
Now that the most current source is downloaded we must compile and make mod-security.
run the following…
Step 3 : Enabling Mod Security
Edit httpd.conf and add the following lines
1 | LoadFile /usr/lib/libxml2.so |
2 | LoadFile /usr/lib/liblua5.1.so |
3 | LoadModule security2_module modules/mod_security2.so |
Step 4 : Verify Apache2 Starts Without Error
1 | sudo /etc/init.d/apache2 restart |
Installing Core Rules Set
Step 1 : Download Current Mod Security CRS
Static Link :
Current Mod Security Core Rule Set *note : again make sure you extract the files.
OR using svn we will do the following
1 | sudo mkdir /etc/apache2/conf/modsecurity |
2 | cd /etc/apache2/conf.d/modsecurity |
Step 2 : Configure rules
Configure your rules any way you need to for your web applications, however at very least you need to do the following.
1 | sudo cp mod_security_crs_10_config.conf.example mod_security_crs_10_config.conf |
Then cleanup
1 | sudo rm README CHANGELOG INSTALL LICENSE |
Step 3 : Enable Mod Security
Add the following lines to httpd.conf
1 | <IfModule security2_module> |
2 | Include conf/modsecurity/crs/*.conf |
3 | Include conf/modsecurity/crs/base_rules/*.conf |
4 | Include conf/modsecurity/crs/activated_rules/*.conf |
5 | </IfModule> |
Step 4: Verify Apache restarts
1 | sudo /etc/init.d/apache2 restart |
It should : Enjoy mod security!
No comments:
Post a Comment