Saturday, June 5, 2010

How to Install Mod Security on Linux Centos 5.4, Fedora 11-12

ModSecurity is a free open source Firewall for Web application which can help you to guard against Intrusion on your webservers like local file inclusion attacks, Cross Site Scripting, and SQL injection vulnerabilities and many more.

The easiest way to install mod_security is using yum, to get the latest package of modsecurity refer to jason litka rpms.
Lets Start

Install the gpg Key

You need to be Root to run this:

[ashwin@ashwin ~]$ rpm –import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka


Create a File

[ashwin@ashwin ~]$ touch /etc/yum.repos.d/utterramblings.repo

Open the File using your favorite editor and add the contents

[ashwin@ashwin ~]$ vim /etc/yum.repos.d/utterramblings.repo

[utterramblings]
name=Jason’s Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Save the File and exit

Now you can Install Mod-Security

[root@ashwin ~]# yum install mod_security
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package mod_security.i386 0:2.5.9-1.jason.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
mod_security            i386       2.5.9-1.jason.1  utterramblings    1.2 M

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): mod_security-2.5.9 100% |=========================| 1.2 MB    00:03
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 0d4306ef
Importing GPG key 0x0D4306EF "Jason Litka (http://www.jasonlitka.com) <jasonlitka@verizon.net>" from http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mod_security                 ######################### [1/1]

Installed: mod_security.i386 0:2.5.9-1.jason.1
Complete!

Great You have installed mod security Restart HTTPD service and Roll. Check the Logs and you will find the magic.

Issues :

1. Starting httpd: httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 3 of /etc/httpd/conf.d/mod_security.conf: Cannot load /etc/httpd/modules/mod_security2.so into server: /etc/httpd/modules/mod_security2.so: undefined symbol: ap_get_server_banner

Solution :

[root@ashwin ~]#  yum remove httpd mod_perl mod_perl-devel mod_security
[root@ashwin ~]#  mv /etc/yum.repos.d/CentOS-Base.repo /tmp ( move base centos repo to /tmp )
[root@ashwin ~]#  yum install httpd ( This will install apache from utterramblings.repo )
[root@ashwin ~]#  yum install mod_perl mod_perl-devel
[root@ashwin ~]#  yum install mod_security

5 comments:

  1. I hope you will keep updating your content constantly as you have one dedicated reader here.

    ReplyDelete
  2. Hi there could I reference some of the information from this post if I reference you with a link back to your site?

    ReplyDelete
  3. Very interesting site, but you must improve your logo graphics.

    ReplyDelete
  4. Hi there! This is nice for sure! Go to go but I will be back (T2 style... if you get what I mean).

    ReplyDelete
  5. Hey Great Post! If anyone needs any roms, games, movies or TV shows you can join my forums, UltraROM.

    ReplyDelete