Issue
The following error occurs when trying to run the modsec_set_setting command:
ERROR [2020-07-01 11:54:07,272] im360.subsys.panels.cpanel.mod_security: whmapi modsec_set_setting command failed:
The system could not validate the new Apache configuration because httpd exited with a nonzero value. Apache produced the following error:
httpd: Syntax error on line 268 of /etc/apache2/conf/httpd.conf: Syntax error on line 32 of /etc/apache2/conf.d/modsec2.conf:
Syntax error on line 29 of /etc/apache2/conf.d/modsec/modsec2.cpanel.conf: Could not open configuration file /etc/apache2/conf.d/modsec_vendor_configs/imunify360-full-apache/000_i360_0.conf: No such file or directory
Environment
- Imunify360
- ModSecurity
- WHM/cPanel
- Any supported OS
Solution
In some cases, to fix the error it may be necessary to reinstall ModSecurity rules for the Imunify vendor.
1. Run the following commands:
mv /var/cpanel/modsec_cpanel_conf_datastore ~/
cat > /var/cpanel/modsec_cpanel_conf_datastore << EOF
---
active_configs: {}
active_vendors: {}
disabled_rules: {}
settings:
SecAuditEngine: RelevantOnly
SecRuleEngine: 'On'
vendor_updates: {}
EOF
imunify360-agent uninstall-vendors
2. If the command fails with the error like:
# imunify360-agent uninstall-vendors
OK
Sentry is attempting to send 1 pending error messages
Waiting up to 2.0 seconds
2.1 Try to remove the ruleset using cPanel tools (change the imunify360-full-apache with installed ruleset):
/scripts/modsec_vendor remove imunify360-full-apache
2.2 Then, install the Imunify vendor again:
imunify360-agent install-vendors
2.3 Check the Apache configuration and restart it:
apachectl configtest
systemctl restart httpd
Useful links
Comments
0 comments
Please sign in to leave a comment.