add imunify page

This commit is contained in:
Usman Nasir
2020-03-06 00:17:01 +05:00
parent 4aeadccc28
commit 0e92dc741b
5 changed files with 72 additions and 1 deletions

View File

@@ -840,6 +840,9 @@
<li><a href="{% url 'CageFS' %}" <li><a href="{% url 'CageFS' %}"
title="{% trans 'CageFS Configurations' %}"><span>{% trans "CageFS" %}</span></a> title="{% trans 'CageFS Configurations' %}"><span>{% trans "CageFS" %}</span></a>
</li> </li>
<li><a href="{% url 'imunify' %}"
title="{% trans 'Imunify 360' %}"><span>{% trans "Imunify 360" %}</span></a>
</li>
</ul> </ul>
</div><!-- .sidebar-submenu --> </div><!-- .sidebar-submenu -->

View File

@@ -1305,7 +1305,7 @@ class FirewallManager:
csfInstalled = 1 csfInstalled = 1
try: try:
command = 'sudo csf -h' command = 'csf -h'
output = ProcessUtilities.outputExecutioner(command) output = ProcessUtilities.outputExecutioner(command)
if output.find("command not found") > -1: if output.find("command not found") > -1:
csfInstalled = 0 csfInstalled = 0
@@ -1541,3 +1541,17 @@ class FirewallManager:
final_dic = {'status': 0, 'error_message': str(msg)} final_dic = {'status': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic) final_json = json.dumps(final_dic)
return HttpResponse(final_json) 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()
return render(self.request, 'firewall/imunify.html', {})
except BaseException as msg:
return HttpResponse(str(msg))

View File

@@ -0,0 +1,37 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "CloudLinux - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "CloudLinux" %}</h2>
<p>{% trans "Access LVEManager" %}</p>
</div>
<div class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "CloudLinux" %}
</h3>
<div class="example-box-wrapper">
<p>{% trans "CloudLinux is now integrated via their new API. You can manage CageFS and Package limits directly from LVEManager by clicking below. You can use your server root credentials to access LVEManager." %}</p>
<br>
<a target="_blank" href="http://{{ ipAddress }}:9000">
<button class="btn btn-primary">Access Now
</button>
</a>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -51,6 +51,11 @@ urlpatterns = [
url(r'^modifyPorts$', views.modifyPorts, name='modifyPorts'), url(r'^modifyPorts$', views.modifyPorts, name='modifyPorts'),
url(r'^modifyIPs$', views.modifyIPs, name='modifyIPs'), url(r'^modifyIPs$', views.modifyIPs, name='modifyIPs'),
## Imunify
url(r'^imunify$', views.imunify, name='imunify'),
] ]

View File

@@ -548,3 +548,15 @@ def modifyIPs(request):
return coreResult return coreResult
except KeyError: except KeyError:
return redirect(loadLoginPage) return redirect(loadLoginPage)
## Imunify
def imunify(request):
try:
userID = request.session['userID']
fm = FirewallManager(request)
return fm.imunify()
except KeyError:
return redirect(loadLoginPage)