Skip to content

Instantly share code, notes, and snippets.

@eladc

eladc/mod_security.sh

Last active Nov 8, 2017
Embed
What would you like to do?
[modsecurity][apache] Mod_Security > 2.9 installation for CentOS 7 / Fedora 25 with owasp rules
#!/bin/bash
echo "Installing ModSecurity ... "
yum install yajl -y 1>/dev/null
rpm -ivh ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/updates/25/x86_64/Packages/l/lua-libs-5.3.4-3.fc25.x86_64.rpm 1>/dev/null
rpm -ivh ftp://ftp.icm.edu.pl/vol/rzm6/linux-fedora-alt/releases/25/Cloud/x86_64/os/Packages/m/mod_security-2.9.1-1.fc25.x86_64.rpm 1>/dev/null
cd /etc/httpd
mkdir crs
cd crs
echo "Installing ModSecurity Rules ... "
git clone https://github.com/SpiderLabs/owasp-modsecurity-crs 1>/dev/null
mv owasp-modsecurity-crs/crs-setup.{conf.example,conf}
mv owasp-modsecurity-crs/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.{conf.example,conf}
mv owasp-modsecurity-crs/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.{conf.example,conf}
cd ..
sed -in 's/modsecurity.d\/activated_rules/crs\/owasp-modsecurity-crs/g' conf.d/mod_security.conf
sed -in 's/modsecurity.d\/local_rules/crs\/owasp-modsecurity-crs\/rules/g' conf.d/mod_security.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment