Install ModSecurity on Debian

To install ModSecurity on Debian/Ubuntu Apache web server, run

apt-get install libapache2-mod-security2

Restart Apache web server

service apache2 restart

Verify mod_security installed with

Advertisement

apachectl -M | grep security

To activate ModSecurity rules, run

cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

Edit

vi /etc/modsecurity/modsecurity.conf

set

SecRuleEngine = on

Get latest rules

mv /usr/share/modsecurity-crs /usr/share/modsecurity-crs.bk
git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git /usr/share/modsecurity-crs

Emable the config file

cp /usr/share/modsecurity-crs/crs-setup.conf.example /usr/share/modsecurity-crs/crs-setup.conf

Edit file

vi  /etc/apache2/mods-enabled/security2.conf

Add

IncludeOptional /usr/share/modsecurity-crs/*.conf
IncludeOptional "/usr/share/modsecurity-crs/rules/*.conf

Restart Apache

service apache2 restart
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement