How to Install ModSecurity in CentOS

ModSecurity is an application firewall that protects your server from script exploits found in web applications.  It is a great tool you can use to tighten security and adds another layer of protection in addition to your network firewall.  This is a brief guide that should help you get ModSecurity installed on a dedicated server running CentOS.

1.  Add the ModSecurity repository.  Since it is not in the standard yum repo, you will need to add it manually.

cd /etc/yum.repos.d

2. Create a file called utterramblings.repo

touch utterramblings.repo

3.  Edit the file with “vi” or “nano” and add the following information:

[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

4. Install the packages with the following command:

yum install mod_security

You will now have a functioning version of mod_security installed and ready to use with Apache web server.  You will still need to configure it, however, which is the topic for another day.

If you would rather not add a third-party repository, you could always compile mod_security from source, but then any updates would be left up to you.  With a yum repository, your mod_security package will be automatically updated with the rest of yum updates, when the time comes.

For more information about installing ModSecurity, consult the project’s website.  For more information about adding repositories to CentOS, see the documentation.

Related Posts











Comments: