mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-09 06:46:10 +01:00
bug fix in csf, ref https://app.clickup.com/t/86enewufa
This commit is contained in:
@@ -51,6 +51,76 @@ class CSF(multi.Thread):
|
|||||||
|
|
||||||
os.chdir('csf')
|
os.chdir('csf')
|
||||||
|
|
||||||
|
|
||||||
|
### manually update csf views.py because it does not load CyberPanel properly in default configurations
|
||||||
|
|
||||||
|
|
||||||
|
content = '''
|
||||||
|
# -*- 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()
|
||||||
|
import json
|
||||||
|
from plogical.acl import ACLManager
|
||||||
|
from plogical.httpProc import httpProc
|
||||||
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
|
import subprocess
|
||||||
|
from django.shortcuts import HttpResponse, render
|
||||||
|
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
|
||||||
|
|
||||||
|
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)
|
||||||
|
'''
|
||||||
|
|
||||||
|
WriteToFile = open('cyberpanel/configservercsf/views.py', 'w')
|
||||||
|
WriteToFile.write(content)
|
||||||
|
WriteToFile.close()
|
||||||
|
|
||||||
command = "chmod +x install.sh"
|
command = "chmod +x install.sh"
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
@@ -79,7 +149,6 @@ class CSF(multi.Thread):
|
|||||||
command = 'ln -s /bin/systemctl /usr/bin/systemctl'
|
command = 'ln -s /bin/systemctl /usr/bin/systemctl'
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.normalExecutioner(command)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath,
|
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath,
|
||||||
'CSF required packages successfully Installed.[200]\n', 1)
|
'CSF required packages successfully Installed.[200]\n', 1)
|
||||||
|
|
||||||
@@ -343,6 +412,10 @@ class CSF(multi.Thread):
|
|||||||
command = 'csf -ra'
|
command = 'csf -ra'
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
|
|
||||||
|
##### update csf views file
|
||||||
|
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'CSF successfully Installed.[200]\n', 1)
|
logging.CyberCPLogFileWriter.statusWriter(CSF.installLogPath, 'CSF successfully Installed.[200]\n', 1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from plogical.httpProc import httpProc
|
|||||||
sys.path.append('/usr/local/CyberCP')
|
sys.path.append('/usr/local/CyberCP')
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||||
django.setup()
|
django.setup()
|
||||||
from django.shortcuts import redirect
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
import json
|
import json
|
||||||
import plogical.CyberCPLogFileWriter as logging
|
import plogical.CyberCPLogFileWriter as logging
|
||||||
|
|||||||
Reference in New Issue
Block a user