mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 09:16:11 +01:00
Enhance ModSecurity rule installation and verification: Update OWASP rules to version 4.18.0, improving detection for installed rules in the FirewallManager. Add checks to verify the existence of OWASP and Comodo configuration files. Update JavaScript to reflect installation status and improve user feedback. Ensure proper logging for installation processes and errors.
https://www.facebook.com/groups/cyberpanel/permalink/3983852698593015/
This commit is contained in:
@@ -1033,14 +1033,24 @@ class FirewallManager:
|
||||
httpdConfig = ProcessUtilities.outputExecutioner(command).splitlines()
|
||||
|
||||
for items in httpdConfig:
|
||||
|
||||
# Check for Comodo rules
|
||||
if items.find('modsec/comodo') > -1:
|
||||
comodoInstalled = 1
|
||||
elif items.find('modsec/owasp') > -1:
|
||||
# Check for OWASP rules - improved detection
|
||||
elif items.find('modsec/owasp') > -1 or items.find('owasp-modsecurity-crs') > -1:
|
||||
owaspInstalled = 1
|
||||
|
||||
if owaspInstalled == 1 and comodoInstalled == 1:
|
||||
break
|
||||
# Additional check: verify OWASP files actually exist
|
||||
if owaspInstalled == 0:
|
||||
owaspPath = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/owasp-modsecurity-crs-4.18.0")
|
||||
if os.path.exists(owaspPath) and os.path.exists(os.path.join(owaspPath, "owasp-master.conf")):
|
||||
owaspInstalled = 1
|
||||
|
||||
# Additional check: verify Comodo files actually exist
|
||||
if comodoInstalled == 0:
|
||||
comodoPath = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/comodo")
|
||||
if os.path.exists(comodoPath) and os.path.exists(os.path.join(comodoPath, "modsecurity.conf")):
|
||||
comodoInstalled = 1
|
||||
|
||||
final_dic = {
|
||||
'modSecInstalled': 1,
|
||||
|
||||
Reference in New Issue
Block a user