From 08996f392a9d3319b09b002df598086cf7db8746 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 30 Aug 2023 21:44:01 +0500 Subject: [PATCH] finalize pre_main_global https://app.clickup.com/t/866atra07 --- baseTemplate/templates/baseTemplate/index.html | 10 +++++----- firewall/firewallManager.py | 15 +++++++++++---- .../templates/firewall/litespeed_ent_conf.html | 6 +++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 499a7ea38..fbd3bc549 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -935,6 +935,11 @@
  • {% trans "LiteSpeed Tuning" %}
  • + {% if serverCheck == 1 %} +
  • {% trans "LiteSpeed Ent Global Conf" %} +
  • + {% endif %}
  • {% trans "PHP Tuning" %}
  • @@ -1044,11 +1049,6 @@
  • {% trans "ModSecurity Rules Packs" %}
  • - {% if serverCheck == 1 %} -
  • {% trans "Litespeed ent conf" %} -
  • - {% endif %}
  • {% trans "CSF" %}
  • diff --git a/firewall/firewallManager.py b/firewall/firewallManager.py index 7881c65c9..22ceae5ce 100755 --- a/firewall/firewallManager.py +++ b/firewall/firewallManager.py @@ -1690,7 +1690,6 @@ class FirewallManager: def saveLitespeed_conf(self, userID = None, data = None): - from urllib.parse import unquote try: currentACL = ACLManager.loadedACL(userID) @@ -1701,15 +1700,23 @@ class FirewallManager: file_path = "/usr/local/lsws/conf/pre_main_global.conf" + command = f'rm -f {file_path}' + ProcessUtilities.executioner(command) + currentLitespeed_conf = data['modSecRules'] + tempRulesPath = '/home/cyberpanel/pre_main_global.conf' + WriteToFile = open(tempRulesPath, 'w') + WriteToFile.write(currentLitespeed_conf) + WriteToFile.close() - # Use sed to replace content in the file - command = f"echo '{currentLitespeed_conf}' > '{file_path}'" - logging.CyberCPLogFileWriter.writeToFile(str(command)) + command = f'mv {tempRulesPath} {file_path}' ProcessUtilities.executioner(command) + command = f'chmod 644 {file_path} && chown lsadm:lsadm {file_path}' + ProcessUtilities.executioner(command, None, True) + command = f'cat {file_path}' diff --git a/firewall/templates/firewall/litespeed_ent_conf.html b/firewall/templates/firewall/litespeed_ent_conf.html index e8b15c575..9995a919a 100644 --- a/firewall/templates/firewall/litespeed_ent_conf.html +++ b/firewall/templates/firewall/litespeed_ent_conf.html @@ -10,14 +10,14 @@
    -

    {% trans "litespeed Ent Conf!" %} - {% trans "litespeed Ent Conf Docs" %}

    -

    {% trans "On this page you can add/delete litespeed Ent Conf." %}

    +

    {% trans "LiteSpeed Enterprise Global Conf!" %}

    +

    {% trans "Any rewrite rules or server-level configurations added here will be applicable to all virtual hosts/websites. This information is valid for LiteSpeed Enterprise edition exclusively." %}

    - {% trans "litespeed Ent Conf" %} + {% trans "Litespeed Enterprise Conf (/usr/local/lsws/conf/pre_main_global.conf)" %}