Skip to content

Commit

Permalink
finalize pre_main_global https://app.clickup.com/t/866atra07
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Aug 30, 2023
1 parent a0af084 commit 08996f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
10 changes: 5 additions & 5 deletions baseTemplate/templates/baseTemplate/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,11 @@
<li><a href="{% url 'liteSpeedTuning' %}"
title="{% trans 'LiteSpeed Tuning' %}"><span>{% trans "LiteSpeed Tuning" %}</span></a>
</li>
{% if serverCheck == 1 %}
<li><a href="{% url 'litespeed_ent_conf' %}"
title="{% trans 'LiteSpeed Ent Global Conf' %}"><span>{% trans "LiteSpeed Ent Global Conf" %}</span></a>
</li>
{% endif %}
<li><a href="{% url 'phpTuning' %}"
title="{% trans 'PHP Tuning' %}"><span>{% trans "PHP Tuning" %}</span></a>
</li>
Expand Down Expand Up @@ -1044,11 +1049,6 @@
<li><a href="{% url 'modSecRulesPacks' %}"
title="{% trans 'ModSecurity Rules Packs' %}"><span>{% trans "ModSecurity Rules Packs" %}</span></a>
</li>
{% if serverCheck == 1 %}
<li><a href="{% url 'litespeed_ent_conf' %}"
title="{% trans 'Litespeed ent conf' %}"><span>{% trans "Litespeed ent conf" %}</span></a>
</li>
{% endif %}
<li><a href="{% url 'csf' %}"
title="{% trans 'ConfigServer Security & Firewall (CSF)' %}"><span>{% trans "CSF" %}</span></a>
</li>
Expand Down
15 changes: 11 additions & 4 deletions firewall/firewallManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,6 @@ def fetchlitespeed_Conf(self, userID = None, data = None):


def saveLitespeed_conf(self, userID = None, data = None):
from urllib.parse import unquote
try:
currentACL = ACLManager.loadedACL(userID)

Expand All @@ -1701,15 +1700,23 @@ def saveLitespeed_conf(self, userID = None, data = None):

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}'

Expand Down
6 changes: 3 additions & 3 deletions firewall/templates/firewall/litespeed_ent_conf.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

<div class="container">
<div id="page-title">
<h2>{% trans "litespeed Ent Conf!" %} - <a target="_blank" href="http://go.cyberpanel.net/modsec-docs" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "litespeed Ent Conf Docs" %}</span></a> </h2>
<p>{% trans "On this page you can add/delete litespeed Ent Conf." %}</p>
<h2>{% trans "LiteSpeed Enterprise Global Conf!" %} </h2>
<p>{% 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." %}</p>
</div>

<div ng-controller="litespeed_ent_conf" class="example-box-wrapper">
<div class="panel panel-body">
<h3 class="content-box-header">
{% trans "litespeed Ent Conf" %} <img ng-hide="modsecLoading" src="/static/images/loading.gif">
{% trans "Litespeed Enterprise Conf (/usr/local/lsws/conf/pre_main_global.conf)" %} <img ng-hide="modsecLoading" src="/static/images/loading.gif">
</h3>

<div class="content-box-wrapper">
Expand Down

0 comments on commit 08996f3

Please sign in to comment.