Can't publish new custom mod_sec rule
We have added mod_sec rules in the past using whm > modsecurity tools > add rule with no issues.
We want to add the following, but got an error when trying to publish:
rule
error after trying to publish rule
/usr/local/apache/logs/error_log
We tried using CMC but that just corrupted everything, httpd wouldn't start, errors everywhere, so we deleted the rule from modsec2.user.conf and were able to start httpd. Can't seem to find anything that explains this anywhere. We're obviously missing something. specs: whm/cpanel v.70.0.12 Apache/2.4.29 (cPanel) OpenSSL/1.0.2n mod_bwlimited/1.4 EasyApache 4 OWASP ModSecurity Core Rule Set V3.0 This happens on all cPanel servers we have, btw.
# Block POST requests by bots accessing wpad
# Whitelist file too just in case.
SecRule REQUEST_URI "wpad" "chain,id:1704,log,t:normalisePath,deny,status:403,msg:'Bot detected - Access denied'"
SecRule REQUEST_METHOD "POST" "chain"
SecRule REMOTE_ADDR "!@ipMatchFromFile /etc/csf/csf.ignore" "chain"
error after trying to publish rule
Error: The system could not deploy the configuration file "modsec/modsec2.user.conf". Review the WHM error_log file for more details about the error.
/usr/local/apache/logs/error_log
AH00526: Syntax error on line 614 of /etc/apache2/conf.d/modsec_vendor_configs/OWASP3/crs-setup.conf:
ModSecurity: Disruptive actions can only be specified by chain starter rules.
We tried using CMC but that just corrupted everything, httpd wouldn't start, errors everywhere, so we deleted the rule from modsec2.user.conf and were able to start httpd. Can't seem to find anything that explains this anywhere. We're obviously missing something. specs: whm/cpanel v.70.0.12 Apache/2.4.29 (cPanel) OpenSSL/1.0.2n mod_bwlimited/1.4 EasyApache 4 OWASP ModSecurity Core Rule Set V3.0 This happens on all cPanel servers we have, btw.
-
I think your chained rule is not saving due to syntax error. The error is the "chain" in the last clause. It should not be there. Modsec assumes you want to chain the next rule that it reads after your rule. The next rule after yours has a disruptive action (as you would expect), so this explains the error you are receiving... Disruptive actions can only be specified by chain starter rules.0 -
Hello, The information in the previous post should help. Let us know if you have any additional questions. Thank you. 0 -
I think your chained rule is not saving due to syntax error. The error is the "chain" in the last clause. It should not be there. Modsec assumes you want to chain the next rule that it reads after your rule. The next rule after yours has a disruptive action (as you would expect), so this explains the error you are receiving...
Disruptive actions can only be specified by chain starter rules.
We got the error and explanation, just having problems fixing it. Having said that, removing the last "chain" did the trick - thanks!0
Please sign in to leave a comment.
Comments
3 comments