Just towards the end of easyapache's recompile of php it does this:
-- End step 'Updating modsec2 conf file for multipart_stric_error ruleset' --
-- Begin step 'Updating rule id(s) and directive names in modsec conf file(s)' --
That second bit adds ID's to all modsec configuration files so if you use something like Atomicorp/gotroot rules it adds id's to them also and this stops easyapache from completing.
The only solution is to re-upload our original unmodified 3rd party rules (Atomic in my case) and easyapache is able to complete as its able to restart httpd once the modified (by easyapache!!) modsec config files are restored so that they do NOT contain those IDs.
AS AN EXAMPLE ...
This following rule is part of atomicorp's "REAL TIME RULES" (not delayed ones):
#Enforce proper requests per HTTP RFC
SecRule REQUEST_LINE "!^(?
?:[a-z]{3,10}\s+(?:\w{3,7}?://[\w\-\./]*(?::\d+)?)?/[^?#]*(?:\?[^#\s]*)?(?:#[\S]*)?|connect (?:\d{1,3}\.)$
"chain,deny,status:403,t:none,t:lowercase,capture,phase:2,rev:2,log,auditlog,msg:'Atomicorp.com WAF Rules: Invalid HTTP Request L$
#Java 1.6 doesnt seem to follow the RFC correctly
SecRule REQUEST_HEADERS:User-Agent "^java/1\.6"
The above is the ORIGINAL, UNMODIFIED, rule - current and up to date and fully functional and valid.
However during easyapache's final step, it adds an id just behind "^java/1\.6" so it looks something like "^java/1\.6" id:123456
and that is what breaks the apache config according to easyapache.
This is part of the easyapache log:
Determining PHP version
Installing IonCube Loader binaries
Activating IonCube Loader extension in /usr/local/lib/php.ini
IonCube Loader extension activated
-- End step 'Install IonCube loader' --
-- End opt 'IonCube Loader for PHP' --
Building global cache for cpanel...Done
Updating Apache configuration
Updating Apache configuration
Updating Apache configuration
Distilled successfully
!! Failed to utilize existing Apache configuration file. Resetting Apache configuration to default. !!
Updating Apache configuration
Updating Apache configuration
Distilled successfully
!! Failed to generate a syntactically correct Apache configuration (/usr/local/apache/conf/httpd.conf.1361919693):
An error occurred while running: /usr/local/apache/bin/httpd -DSSL -t -f /usr/local/apache/conf/httpd.conf.1361919693
Exit signal was: 0
Exit value was: 1
Output was:
---
Syntax error on line 42 of /usr/local/apache/conf/modsec/10_asl_rules.conf:
ModSecurity: Metadata actions (id, rev, msg, tag, severity, ver, accuracy, maturity, logdata) can only be specified by chain starter rules.
---
!!
!! Archiving successful build so it can be restored via --restore-archive once the httpd.conf are resolved !!
!! 'safecopy(/usr/local/apache/etc, /usr/local/apache.ea3-buildok-confgen-failed)' did not return true !!
!! Done Archiving successful build !!
!! Restoring original working apache !!
Note the bit in BOLD. Line 42 is "SecRule REQUEST_HEADERS:User-Agent "^java/1\.6" but it looks something like SecRule REQUEST_HEADERS:User-Agent "^java/1\.6" id:123456 because easyapache ADDED the id bit.
-- End step 'Updating modsec2 conf file for multipart_stric_error ruleset' --
-- Begin step 'Updating rule id(s) and directive names in modsec conf file(s)' --
That second bit adds ID's to all modsec configuration files so if you use something like Atomicorp/gotroot rules it adds id's to them also and this stops easyapache from completing.
The only solution is to re-upload our original unmodified 3rd party rules (Atomic in my case) and easyapache is able to complete as its able to restart httpd once the modified (by easyapache!!) modsec config files are restored so that they do NOT contain those IDs.
AS AN EXAMPLE ...
This following rule is part of atomicorp's "REAL TIME RULES" (not delayed ones):
#Enforce proper requests per HTTP RFC
SecRule REQUEST_LINE "!^(?
"chain,deny,status:403,t:none,t:lowercase,capture,phase:2,rev:2,log,auditlog,msg:'Atomicorp.com WAF Rules: Invalid HTTP Request L$
#Java 1.6 doesnt seem to follow the RFC correctly
SecRule REQUEST_HEADERS:User-Agent "^java/1\.6"
The above is the ORIGINAL, UNMODIFIED, rule - current and up to date and fully functional and valid.
However during easyapache's final step, it adds an id just behind "^java/1\.6" so it looks something like "^java/1\.6" id:123456
and that is what breaks the apache config according to easyapache.
This is part of the easyapache log:
Determining PHP version
Installing IonCube Loader binaries
Activating IonCube Loader extension in /usr/local/lib/php.ini
IonCube Loader extension activated
-- End step 'Install IonCube loader' --
-- End opt 'IonCube Loader for PHP' --
Building global cache for cpanel...Done
Updating Apache configuration
Updating Apache configuration
Updating Apache configuration
Distilled successfully
!! Failed to utilize existing Apache configuration file. Resetting Apache configuration to default. !!
Updating Apache configuration
Updating Apache configuration
Distilled successfully
!! Failed to generate a syntactically correct Apache configuration (/usr/local/apache/conf/httpd.conf.1361919693):
An error occurred while running: /usr/local/apache/bin/httpd -DSSL -t -f /usr/local/apache/conf/httpd.conf.1361919693
Exit signal was: 0
Exit value was: 1
Output was:
---
Syntax error on line 42 of /usr/local/apache/conf/modsec/10_asl_rules.conf:
ModSecurity: Metadata actions (id, rev, msg, tag, severity, ver, accuracy, maturity, logdata) can only be specified by chain starter rules.
---
!!
!! Archiving successful build so it can be restored via --restore-archive once the httpd.conf are resolved !!
!! 'safecopy(/usr/local/apache/etc, /usr/local/apache.ea3-buildok-confgen-failed)' did not return true !!
!! Done Archiving successful build !!
!! Restoring original working apache !!
Note the bit in BOLD. Line 42 is "SecRule REQUEST_HEADERS:User-Agent "^java/1\.6" but it looks something like SecRule REQUEST_HEADERS:User-Agent "^java/1\.6" id:123456 because easyapache ADDED the id bit.