Applicable to:
- Plesk for Linux
Question
How to add custom directives or custom rule set for ModSecurity via CLI?
Answer
In order to add custom directives for "Atomic Basic ModSecurity" follow these steps:
-
Connect to the server via SSH .
-
Enable ModSecurity:
# plesk bin server_pref --update-web-app-firewall -waf-rule-engine on
-
Create a configuration file for custom rules in
/etc/apache2/conf.d
or/etc/httpd/conf.d
directory. As an example:# cd /etc/httpd/conf.d
# wget https://www.atomicorp.com/examples/01_modsecurity.conf -
Put custom rules into the
/etc/httpd/modsecurity.custom.d/99_zzz_custom.conf
file. -
Check Apache configuration:
# httpd -t
Syntax OK -
If test was successful, restart Apache with the following command:
# service httpd restart
For more information visit Official CLI Linux Plesk Documentation .
As an alternative, you can set full custom rule set with following command:
# plesk bin server_pref --update-web-app-firewall -waf-rule-engine on -waf-rule-set custom -waf-archive-path /root/custom_rule_set.conf.tgz
Note: The file custom_rule_set.conf.tgz
should contain only .conf files for usage on ModSecurity custom ruleset.
Comments
0 comments
Please sign in to leave a comment.