mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 08:16:11 +01:00
further refoctor default render firewall
This commit is contained in:
@@ -466,14 +466,6 @@ class FirewallManager:
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def loadModSecurityHome(self, request = None, userID = None):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
OLS = 1
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
@@ -495,9 +487,6 @@ class FirewallManager:
|
||||
{'modSecInstalled': modSecInstalled, 'OLS': OLS}, 'admin')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def installModSec(self, userID = None, data = None):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
@@ -852,15 +841,6 @@ class FirewallManager:
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def modSecRules(self, request = None, userID = None):
|
||||
try:
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
|
||||
@@ -879,8 +859,6 @@ class FirewallManager:
|
||||
proc = httpProc(request, 'firewall/modSecurityRules.html',
|
||||
{'modSecInstalled': modSecInstalled}, 'admin')
|
||||
return proc.render()
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def fetchModSecRules(self, userID = None, data = None):
|
||||
try:
|
||||
@@ -977,15 +955,6 @@ class FirewallManager:
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def modSecRulesPacks(self, request = None, userID = None):
|
||||
try:
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
@@ -1006,9 +975,6 @@ class FirewallManager:
|
||||
{'modSecInstalled': modSecInstalled}, 'admin')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(msg)
|
||||
|
||||
def getOWASPAndComodoStatus(self, userID = None, data = None):
|
||||
try:
|
||||
|
||||
@@ -1284,15 +1250,6 @@ class FirewallManager:
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def csf(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
csfInstalled = 1
|
||||
try:
|
||||
command = 'csf -h'
|
||||
@@ -1306,9 +1263,6 @@ class FirewallManager:
|
||||
{'csfInstalled': csfInstalled}, 'admin')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def installCSF(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
@@ -1537,15 +1491,6 @@ class FirewallManager:
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def imunify(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
@@ -1576,10 +1521,6 @@ class FirewallManager:
|
||||
data, 'admin')
|
||||
return proc.render()
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitinstallImunify(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
@@ -1607,15 +1548,6 @@ class FirewallManager:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
|
||||
|
||||
def imunifyAV(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
ipFile = "/etc/cyberpanel/machineIP"
|
||||
f = open(ipFile)
|
||||
ipData = f.read()
|
||||
@@ -1626,8 +1558,6 @@ class FirewallManager:
|
||||
data = {}
|
||||
data['ipAddress'] = fullAddress
|
||||
|
||||
|
||||
|
||||
if os.path.exists(FirewallManager.imunifyAVPath):
|
||||
data['imunify'] = 1
|
||||
else:
|
||||
@@ -1642,11 +1572,6 @@ class FirewallManager:
|
||||
data, 'admin')
|
||||
return proc.render()
|
||||
|
||||
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
def submitinstallImunifyAV(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
|
||||
Reference in New Issue
Block a user