OS: Debian 12
Steps 1: Install Apache2
sudo apt update
sudo apt install apache2
Step 2: Install ModSecurity with Apache on Debian/Ubuntu
The ModSecurity module for Apache is included in the default Debian/Ubuntu repository. To install it, run
sudo apt install libapache2-mod-security2
Then enable this module.
Then enable this module.
sudo a2enmod security2
Restart Apache for the change to take effect.
Restart Apache for the change to take effect.
sudo systemctl restart apache2
Check /etc/apache2/mods-enabled/security2.conf
In the above configuration file, you can find the following line. Make sure its exists
IncludeOptional /etc/modsecurity/*.conf
And copy example configuration file into /etc/modsecurity/modsecurity.conf
mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf
Find the following configuration and then change like below:
#SecRuleEngine DetectionOnly
SecRuleEngine On
Step 4: Enable the Latest Rule Set
to be continued
Ref:
https://www.linuxbabe.com/security/modsecurity-apache-debian-ubuntu
https://tecadmin.net/how-to-setup-apache-modsecurity-on-ubuntu/
Comments
Post a Comment