{"id":4693,"date":"2014-09-21T12:35:56","date_gmt":"2014-09-21T17:35:56","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4693"},"modified":"2022-06-03T03:46:40","modified_gmt":"2022-06-03T08:46:40","slug":"install-mod_security-with-the-owasp-core-rule-set-on-a-centos-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-mod_security-with-the-owasp-core-rule-set-on-a-centos-vps\/","title":{"rendered":"Install mod_security with the OWASP core rule set on a CentOS VPS"},"content":{"rendered":"
Mod_Security is free and open source web application firewall for Apache and Nginx. It is very useful for protecting your web server from various attacks by blocking most of the known exploits using regular expressions and rule sets. Mod_security can detect attacks by monitoring and analyzing the HTTP traffic in real time. In this blog tutorial we will guide you through the process of installing mod_security with the OWASP (Open Web Application Security Project) core rule set on a CentOS VPS<\/a> from source. Log in to your your server as user ‘root’ and make sure that all packages are up to date:<\/p>\n Before we start the installation of mod_security, we need to install the following dependencies first<\/p>\n Download the mod_security source code from their official website to your server<\/p>\n Extract the downloaded archive and change the current working directory to the newly extracted directory<\/p>\n Now, lets configure, compile and install mod_security from the source code<\/p>\n Copy the default mod_security configuration and the unicode.mapping<\/em> file to the necessary Apache directory<\/p>\n With this step, mod_security is installed on your server. Now we need to configure the Apache web server. Open the web server configuration file and add the following line<\/p>\n Save the changes and restart Apache<\/p>\n Download and configure OWASP (Open Web Application Security Project) core rule set for a base configuration<\/p>\n Open the Apache configuration file again, and add the following lines at the end of the flie<\/p>\n Save the file and restart the web server again<\/p>\n That’s all. You have mod_security with the OWASP core rule set installed on your CentOS VPS. Of course you don\u2019t have to do any of this if you use one of our Linux VPS hosting <\/a>services, in which case you can simply ask our expert Linux admins to install Mod_security for you. They are available 24\u00d77 and will take care of your request immediately. Mod_Security is free and open source web application firewall for Apache and Nginx. It is very useful for protecting your … <\/p>\nyum -y update<\/pre>\n
yum install gcc make httpd-devel libxml2 pcre-devel libxml2-devel curl-devel git<\/pre>\n
cd \/opt\/\r\nwget https:\/\/www.modsecurity.org\/tarball\/2.9.1\/modsecurity-2.9.1.tar.gz<\/pre>\n
tar xzfv modsecurity-2.9.1.tar.gz \r\ncd modsecurity-2.9.1<\/pre>\n
.\/configure\r\nmake\r\nmake install<\/pre>\n
cp modsecurity.conf-recommended \/etc\/httpd\/conf.d\/modsecurity.conf\r\ncp unicode.mapping \/etc\/httpd\/conf.d\/<\/pre>\n
nano \/etc\/httpd\/conf\/httpd.conf\r\nLoadModule security2_module modules\/mod_security2.so\r\nLoadModule unique_id_module modules\/mod_unique_id.so<\/pre>\n
\/etc\/init.d\/httpd restart<\/pre>\n
cd \/etc\/httpd\r\ngit clone https:\/\/github.com\/SpiderLabs\/owasp-modsecurity-crs.git\r\nmv owasp-modsecurity-crs modsecurity-crs\r\ncd modsecurity-crs\r\ncp modsecurity_crs_10_setup.conf.example modsecurity_crs_10_config.conf<\/pre>\n
Include modsecurity-crs\/modsecurity_crs_10_config.conf\r\n Include modsecurity-crs\/base_rules\/*.conf\r\n<\/pre>\n
\/etc\/init.d\/httpd restart<\/pre>\n
\nPS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"