bug fix: add csf gui
This commit is contained in:
parent
c80ef3288f
commit
e95bb568d9
|
|
@ -44,5 +44,6 @@ urlpatterns = [
|
|||
path('container/', include('containerization.urls')),
|
||||
path('CloudLinux/', include('CLManager.urls')),
|
||||
path('IncrementalBackups/', include('IncBackups.urls')),
|
||||
# path(r'configservercsf/',include('configservercsf.urls')),
|
||||
# path('Terminal/', include('WebTerminal.urls')),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
#default_app_config = 'configservercsf.apps.configservercsfConfig'
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
class configservercsfConfig(AppConfig):
|
||||
name = 'configservercsf'
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cyberpanelPluginConfig>
|
||||
<name>ConfigServer Security and Firewall</name>
|
||||
<type>plugin</type>
|
||||
<description>ConfigServer Security and Firewall</description>
|
||||
<version>1.0</version>
|
||||
</cyberpanelPluginConfig>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
from django.dispatch import receiver
|
||||
from django.shortcuts import redirect
|
||||
from firewall.signals import preFirewallHome, preCSF
|
||||
|
||||
@receiver(preFirewallHome)
|
||||
def csfFirewallHome(sender, **kwargs):
|
||||
request = kwargs['request']
|
||||
return redirect('/configservercsf/')
|
||||
|
||||
@receiver(preCSF)
|
||||
def csfCSF(sender, **kwargs):
|
||||
request = kwargs['request']
|
||||
return redirect('/configservercsf/')
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}ConfigServer Security and Firewall{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
<iframe border="0" name='myiframe' id='myiframe' src="/configservercsf/iframe/" style="width: 100%;" frameborder="0" onload="resizeIframe(this);"></iframe>
|
||||
<script>
|
||||
function resizeIframe(obj) {
|
||||
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
window.parent.parent.scrollTo(0,0);
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<a href="#" title="ConfigServer Services">
|
||||
<i class="glyph-icon icon-bug"></i>
|
||||
<span>ConfigServer Services</span>
|
||||
</a>
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
{% url 'configservercsf' as the_url %}
|
||||
{% if the_url %}
|
||||
<li><a href="{% url 'configservercsf' %}"
|
||||
title="ConfigServer Security & Firewall"><span>ConfigServer Security & Firewall</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% url 'configservercxs' as the_url %}
|
||||
{% if the_url %}
|
||||
<li><a href="{% url 'configservercxs' %}"
|
||||
title="ConfigServer Exploit Scanner"><span>ConfigServer Exploit Scanner</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</div><!-- .sidebar-submenu -->
|
||||
</li>
|
||||
|
||||
<li class="serverACL">
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
from django.urls import path, re_path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.configservercsf, name='configservercsf'),
|
||||
path('iframe/', views.configservercsfiframe, name='configservercsfiframe'),
|
||||
]
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
from plogical.acl import ACLManager
|
||||
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
import tempfile
|
||||
from django.http import HttpResponse
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from plogical.httpProc import httpProc
|
||||
|
||||
def configservercsf(request):
|
||||
proc = httpProc(request, 'configservercsf/index.html',
|
||||
None, 'admin')
|
||||
return proc.render()
|
||||
|
||||
@csrf_exempt
|
||||
@xframe_options_exempt
|
||||
def configservercsfiframe(request):
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if request.method == 'GET':
|
||||
qs = request.GET.urlencode()
|
||||
elif request.method == 'POST':
|
||||
qs = request.POST.urlencode()
|
||||
|
||||
try:
|
||||
tmp = tempfile.NamedTemporaryFile(mode = "w", delete=False)
|
||||
tmp.write(qs)
|
||||
tmp.close()
|
||||
command = "/usr/local/csf/bin/cyberpanel.pl '" + tmp.name + "'"
|
||||
|
||||
try:
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
except:
|
||||
output = "Output Error from csf UI script"
|
||||
|
||||
os.unlink(tmp.name)
|
||||
except:
|
||||
output = "Unable to create csf UI temp file"
|
||||
|
||||
return HttpResponse(output)
|
||||
|
|
@ -155,6 +155,7 @@ urlpatterns = [
|
|||
WriteToFile.write(content)
|
||||
WriteToFile.close()
|
||||
|
||||
|
||||
command = "chmod +x install.sh"
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
|
|
@ -475,30 +476,43 @@ urlpatterns = [
|
|||
# for cmd in sed_commands:
|
||||
# ProcessUtilities.executioner(cmd)
|
||||
|
||||
command = 'rm -Rfv /usr/local/CyberCP/configservercsf'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
# command = 'rm -Rfv /usr/local/CyberCP/configservercsf'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# command = 'rm -fv /home/cyberpanel/plugins/configservercsf'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# command = 'rm -Rfv /usr/local/CyberCP/public/static/configservercsf'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/settings.py'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/urls.py'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# if not os.path.exists('/etc/cxs/cxs.pl'):
|
||||
#
|
||||
# command = 'sed -i "/configserver/d" /usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
#
|
||||
# command = 'killall lswsgi'
|
||||
# ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'rm -fv /home/cyberpanel/plugins/configservercsf'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
data = open('/usr/local/CyberCP/CyberCP/urls.py', 'r').readlines()
|
||||
|
||||
command = 'rm -Rfv /usr/local/CyberCP/public/static/configservercsf'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
WriteToFile = open('/usr/local/CyberCP/CyberCP/urls.py', 'w')
|
||||
|
||||
command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/settings.py'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
command = 'sed -i "/configservercsf/d" /usr/local/CyberCP/CyberCP/urls.py'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
if not os.path.exists('/etc/cxs/cxs.pl'):
|
||||
|
||||
command = 'sed -i "/configserver/d" /usr/local/CyberCP/baseTemplate/templates/baseTemplate/index.html'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
for line in data:
|
||||
if line[0] == '#' and line.find('configservercsf') > -1:
|
||||
WriteToFile.write(" path(r'configservercsf/',include('configservercsf.urls')),\n")
|
||||
else:
|
||||
WriteToFile.write(line)
|
||||
WriteToFile.close()
|
||||
|
||||
command = 'killall lswsgi'
|
||||
ProcessUtilities.normalExecutioner(command)
|
||||
|
||||
|
||||
return 1
|
||||
except BaseException as msg:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue