From 74d3ba1c3fbe92af77aa39fe306e545831c87814 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 26 Jan 2024 11:43:23 +0500 Subject: [PATCH 1/4] vchange --- databases/databaseManager.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/databases/databaseManager.py b/databases/databaseManager.py index 6811966cf..c2a17d05c 100755 --- a/databases/databaseManager.py +++ b/databases/databaseManager.py @@ -2,6 +2,8 @@ import os.path import sys import django +from django.shortcuts import redirect + sys.path.append('/usr/local/CyberCP') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") django.setup() @@ -85,8 +87,33 @@ def deleteDatabase(self, request = None, userID = None): return proc.render() def MySQLManager(self, request = None, userID = None): + + try: + + from plogical.processUtilities import ProcessUtilities + if ProcessUtilities.decideServer() == ProcessUtilities.OLS: + + url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" + data = { + "name": "Filemanager", + "IP": ACLManager.fetchIP() + } + + import requests + response = requests.post(url, data=json.dumps(data)) + Status = response.json()['status'] + + if (Status == 1): + template = 'baseTemplate/FileManager.html' + else: + return redirect("https://cyberpanel.net/cyberpanel-addons") + else: + template = 'databases/mysqlmanager.html' + except BaseException as msg: + template = 'databases/mysqlmanager.html' + template = 'databases/mysqlmanager.html' - proc = httpProc(request, template, None) + proc = httpProc(request, template, None, 'admin') return proc.render() def OptimizeMySQL(self, request = None, userID = None): from cloudAPI.cloudManager import CloudManager @@ -95,14 +122,12 @@ def OptimizeMySQL(self, request = None, userID = None): data1 = json.loads(result.content) - - data = {} data['ramInGB'] = data1.get('ramInGB') data['conf'] = data1.get('conf') template = 'databases/OptimizeMySQL.html' - proc = httpProc(request, template, data) + proc = httpProc(request, template, data, 'admin') return proc.render() def fetchDatabases(self, userID = None, data = None): From a95c9d08a6e4a50341675eb733d7fc0665680337 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 26 Jan 2024 11:45:13 +0500 Subject: [PATCH 2/4] vchange --- databases/views.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/databases/views.py b/databases/views.py index 241adf44a..cd2dd3221 100755 --- a/databases/views.py +++ b/databases/views.py @@ -375,6 +375,13 @@ def getMysqlstatus(request): userID = request.session['userID'] finalData = mysqlUtilities.showStatus() + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + finalData = json.dumps(finalData) return HttpResponse(finalData) @@ -386,6 +393,12 @@ def restartMySQL(request): try: userID = request.session['userID'] finalData = mysqlUtilities.restartMySQL() + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) data = {} @@ -402,6 +415,13 @@ def generateRecommendations(request): try: userID = request.session['userID'] + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + data = json.loads(request.body) detectedRam = data['detectedRam'] @@ -418,9 +438,17 @@ def generateRecommendations(request): def applyMySQLChanges(request): try: + userID = request.session['userID'] + + currentACL = ACLManager.loadedACL(userID) + + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + data = json.loads(request.body) - logging.writeToFile("=-------------------------------------------") finalData = mysqlUtilities.applyMySQLChanges(data) data = {} From 9110d780643ce612f06b300755b5b1726501b9c3 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 26 Jan 2024 12:37:11 +0500 Subject: [PATCH 3/4] vchange --- baseTemplate/views.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/baseTemplate/views.py b/baseTemplate/views.py index 574ee9c2f..921ac9b03 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -151,6 +151,13 @@ def getLoadAverage(request): def versionManagment(request): ## Get latest version + val = request.session['userID'] + currentACL = ACLManager.loadedACL(val) + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + getVersion = requests.get('https://cyberpanel.net/version.txt') latest = getVersion.json() latestVersion = latest['version'] @@ -224,6 +231,12 @@ def upgrade(request): def upgradeStatus(request): try: val = request.session['userID'] + currentACL = ACLManager.loadedACL(val) + if currentACL['admin'] == 1: + pass + else: + return ACLManager.loadErrorJson('FilemanagerAdmin', 0) + try: if request.method == 'POST': from plogical.upgrade import Upgrade @@ -252,8 +265,6 @@ def upgradeStatus(request): 'error_message': "None", 'upgradeLog': upgradeLog}) return HttpResponse(final_json) - - except BaseException as msg: final_dic = {'upgradeStatus': 0, 'error_message': str(msg)} final_json = json.dumps(final_dic) @@ -266,6 +277,9 @@ def upgradeStatus(request): def upgradeVersion(request): try: + + + vers = version.objects.get(pk=1) getVersion = requests.get('https://cyberpanel.net/version.txt') latest = getVersion.json() From 0022661fead605597b7d5f58f4caf7a6b10ee495 Mon Sep 17 00:00:00 2001 From: Master3395 Date: Sun, 28 Jan 2024 20:47:14 +0100 Subject: [PATCH 4/4] Update php versions This change adds php 80, 81 and 82 to the missing places. And removes .bak file from the read me. Updating the readme to add php 8.2 Add php limit extension for php 6, 7 and 8 --- README.md | 1 + README.md.bak | 52 ----------------------------------- install/php-configs/www.conf | 2 +- install/phpconfigs/php80.conf | 6 ++-- install/phpconfigs/php81.conf | 16 +++++++++++ install/phpconfigs/php82.conf | 16 +++++++++++ 6 files changed, 37 insertions(+), 56 deletions(-) delete mode 100644 README.md.bak create mode 100644 install/phpconfigs/php81.conf create mode 100644 install/phpconfigs/php82.conf diff --git a/README.md b/README.md index c18ea068a..5a41bb149 100755 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Web Hosting Control Panel that uses OpenLiteSpeed as the underlying Web Server. # Supported PHP Versions +* PHP 8.2 * PHP 8.1 * PHP 8.0 * PHP 7.4 diff --git a/README.md.bak b/README.md.bak deleted file mode 100644 index ff9c97e70..000000000 --- a/README.md.bak +++ /dev/null @@ -1,52 +0,0 @@ -# CyberPanel - -Webhosting control panel that uses OpenLiteSpeed as web server. - -## Features - -* Different Level Of users. -* Auto SSL. -* FTP Server. -* Light weight DNS Server (PowerDNS). -* PHPMYAdmin. -* Email Support (Rainloop). -* FileManager. -* PHP Managment. -* Firewall (FirewallD & ConfigServer Firewall Intregration). -* One click Backup and Restore. - -# Supported PHPs - -* PHP 5.3 -* PHP 5.4 -* PHP 5.5 -* PHP 5.6 -* PHP 7.0 -* PHP 7.1 -* PHP 7.2 -* PHP 7.3 -* PHP 7.4 -* PHP 8.0 - -# Installation Instructions - - -``` -sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh) -``` - -# Upgrading - - -``` -sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh) -``` - -# Resources - -* [Official Site.](https://cyberpanel.net) -* [Documentation.](https://docs.cyberpanel.net) -* [Forums.](https://forums.cyberpanel.net) -* [Discord.](https://discord.gg/g8k8Db3) -* [Facebook Group.](https://www.facebook.com/groups/cyberpanel) - diff --git a/install/php-configs/www.conf b/install/php-configs/www.conf index 29ef69b6a..b838e3f99 100755 --- a/install/php-configs/www.conf +++ b/install/php-configs/www.conf @@ -381,7 +381,7 @@ slowlog = /var/log/php-fpm/www-slow.log ; exectute php code. ; Note: set an empty value to allow all extensions. ; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 +;security.limit_extensions = .php .php3 .php4 .php5 .php7 .php8 ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; the current environment. diff --git a/install/phpconfigs/php80.conf b/install/phpconfigs/php80.conf index d60ccd0d7..fb034fbdd 100755 --- a/install/phpconfigs/php80.conf +++ b/install/phpconfigs/php80.conf @@ -1,13 +1,13 @@ -php74.confextprocessor php74 { +php74.confextprocessor php80 { type lsapi - address uds://tmp/lshttpd/lsphp74.sock + address uds://tmp/lshttpd/lsphp80.sock maxConns 50 initTimeout 60 retryTimeout 0 persistConn 1 respBuffer 0 autoStart 1 - path /usr/local/lsws/lsphp74/bin/lsphp + path /usr/local/lsws/lsphp80/bin/lsphp memSoftLimit 2047M memHardLimit 2047M procSoftLimit 400 diff --git a/install/phpconfigs/php81.conf b/install/phpconfigs/php81.conf new file mode 100644 index 000000000..d43f5abe4 --- /dev/null +++ b/install/phpconfigs/php81.conf @@ -0,0 +1,16 @@ +php74.confextprocessor php81 { + type lsapi + address uds://tmp/lshttpd/lsphp81.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp81/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} + diff --git a/install/phpconfigs/php82.conf b/install/phpconfigs/php82.conf new file mode 100644 index 000000000..df4bd1d08 --- /dev/null +++ b/install/phpconfigs/php82.conf @@ -0,0 +1,16 @@ +php74.confextprocessor php82 { + type lsapi + address uds://tmp/lshttpd/lsphp82.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp82/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} +