mod_security completely messed up beyond repair

The German

Registered
Nov 23, 2016
2
3
1
USA
cPanel Access Level
Website Owner
Suddenly (I assume due to to cpanel automatic update), the complete mod_security configuration is gone and almost all related files are missing.

  1. When trying to save the configuration (Home »Security Center »ModSecurity™ Configuration »Configure Global Directives)
    I get the message here:
    Error: The system could not save your ModSecurity™ settings because of the following error: The system could not save some of the settings.

  2. The vendor management is corrupted as well (Home »Security Center »ModSecurity™ Vendors »Manage Vendors)https://secure.managed-hosts.com:2087/cpsess2386655824/scripts2/manage_mod_security_vendors/vendors
    It shows OWASP "This vendor is not installed", when clicking on the "install" button, the only thing that happens is an error message:

    Error: The system experienced the following error when it attempted to install the “OWASP ModSecurity Core Rule Set” vendor: API failure: 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 219 of /etc/apache2/conf/httpd.conf: Syntax error on line 32mo of /etc/apache2/conf.d/modsec2.conf: Could not open configuration file /etc/apache2/conf.d/modsec/modsec2.user.conf: No such file or directory

    Line 219 in httpd.conf:
    Include "/etc/apache2/conf.d/*.conf"

    Line 32 in modec2.conf:
    Include /etc/apache2/conf.d/modsec/modsec2.cpanel.conf

  3. File /etc/apache2/conf.d/modsec/modsec2.user.conf exists but has a zero byte size
This is beyond frustrating - everything was working (including cxs!) and now EVERYTHING has been erased and Cpanel is unable to even fix the problem. What a mess...

Any thoughts?
 

Nathaniel Evans

Registered
Jan 10, 2017
1
0
76
nj
cPanel Access Level
Root Administrator
Hi. I have the same problem. I recently upgraded to Easy Apache 4 and now I get this--
Error:The system experienced the following error when it attempted to install the “OWASP ModSecurity Core Rule Set” vendor: API failure: 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 223 of /etc/apache2/conf/httpd.conf: Syntax error on line 32 of /etc/apache2/conf.d/modsec2.conf: Syntax error on line 28 of /etc/apache2/conf.d/modsec/modsec2.cpanel.conf: Could not open configuration file /etc/apache2/conf.d/modsec_vendor_configs/configserver/00_configserver.conf: No such file or directory

Please help. What am I doing wrong?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
Hello @Nathaniel Evans,

To update, it looks like this issue was addressed via a support ticket with the following commands:

Code:
# mkdir /etc/apache2/conf.d/modsec_vendor_configs/configserver
# touch /etc/apache2/conf.d/modsec_vendor_configs/configserver/00_configserver.conf
Thank you.