From 13bfef2b5686bfc53bbb3ae7ca56fadc11f7e334 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 20 Nov 2024 14:07:33 +0500 Subject: [PATCH 1/8] bug fix: maintain csf custom configs ref: https://github.com/usmannasir/cyberpanel/issues/1353 --- plogical/upgrade.py | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index edb136ae0..b89b5a65e 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -3556,12 +3556,59 @@ pm.max_spare_servers = 3 #Upgrade.executioner(command, 'fix csf if there', 0) if os.path.exists('/etc/csf'): + ##### Function to backup custom csf files and restore + + from datetime import datetime + + # List of files to backup + FILES = [ + "/etc/csf/csf.allow", + "/etc/csf/csf.deny", + "/etc/csf/csf.conf", + "/etc/csf/csf.ignore", + "/etc/csf/csf.rignore", + "/etc/csf/csf.blocklists", + ] + + # Directory for backups + BACKUP_DIR = f"/home/cyberpanel/csf_backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}" + + # Backup function + def backup_files(): + os.makedirs(BACKUP_DIR, exist_ok=True) + for file in FILES: + if os.path.exists(file): + shutil.copy(file, BACKUP_DIR) + print(f"Backed up: {file}") + else: + print(f"File not found, skipping: {file}") + + # Restore function + def restore_files(): + for file in FILES: + backup_file = os.path.join(BACKUP_DIR, os.path.basename(file)) + if os.path.exists(backup_file): + shutil.copy(backup_file, file) + print(f"Restored: {file}") + else: + print(f"Backup not found for: {file}") + + # Backup the files + print("Backing up files...") + backup_files() + execPath = "sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/csf.py" execPath = execPath + " removeCSF" Upgrade.executioner(execPath, 'fix csf if there', 0) execPath = "sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/csf.py" execPath = execPath + " installCSF" + + # Restore the files + print("Restoring files...") + restore_files() + + Upgrade.executioner(execPath, 'fix csf if there', 0) From aecb42026ffaf7972bdd5e8b45cbb1878d7f97bd Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 20 Nov 2024 14:55:59 +0500 Subject: [PATCH 2/8] bug fix: maintain csf custom configs ref: https://github.com/usmannasir/cyberpanel/issues/1353 --- plogical/upgrade.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index b89b5a65e..2c02dc2e8 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -3568,6 +3568,7 @@ pm.max_spare_servers = 3 "/etc/csf/csf.ignore", "/etc/csf/csf.rignore", "/etc/csf/csf.blocklists", + "/etc/csf/csf.dyndns" ] # Directory for backups From 68832c4820fac37db14bb7a4d183c411c5510c19 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 24 Nov 2024 14:54:22 +0500 Subject: [PATCH 3/8] version change --- CLScript/CLMain.py | 2 +- baseTemplate/views.py | 2 +- install/install.py | 2 +- loginSystem/views.py | 2 +- plogical/adminPass.py | 2 +- plogical/backupUtilities.py | 2 +- plogical/upgrade.py | 2 +- serverStatus/views.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CLScript/CLMain.py b/CLScript/CLMain.py index 64590cf5b..7fe666ab5 100644 --- a/CLScript/CLMain.py +++ b/CLScript/CLMain.py @@ -5,7 +5,7 @@ class CLMain(): self.path = '/usr/local/CyberCP/version.txt' #versionInfo = json.loads(open(self.path, 'r').read()) self.version = '2.3' - self.build = '8' + self.build = '9' ipFile = "/etc/cyberpanel/machineIP" f = open(ipFile) diff --git a/baseTemplate/views.py b/baseTemplate/views.py index 29359d7a9..14b80d9d5 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -21,7 +21,7 @@ from plogical.httpProc import httpProc # Create your views here. VERSION = '2.3' -BUILD = 8 +BUILD = 9 @ensure_csrf_cookie diff --git a/install/install.py b/install/install.py index 12fa1b46c..c01206e09 100755 --- a/install/install.py +++ b/install/install.py @@ -15,7 +15,7 @@ from stat import * import stat VERSION = '2.3' -BUILD = 8 +BUILD = 9 char_set = {'small': 'abcdefghijklmnopqrstuvwxyz', 'nums': '0123456789', 'big': 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'} diff --git a/loginSystem/views.py b/loginSystem/views.py index 051adb3b6..b10f7f658 100644 --- a/loginSystem/views.py +++ b/loginSystem/views.py @@ -17,7 +17,7 @@ from django.utils import translation # Create your views here. VERSION = '2.3' -BUILD = 8 +BUILD = 9 def verifyLogin(request): diff --git a/plogical/adminPass.py b/plogical/adminPass.py index 4e74dae57..cb1dc308d 100755 --- a/plogical/adminPass.py +++ b/plogical/adminPass.py @@ -13,7 +13,7 @@ from packages.models import Package from baseTemplate.models import version VERSION = '2.3' -BUILD = 8 +BUILD = 9 if not os.geteuid() == 0: sys.exit("\nOnly root can run this script\n") diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 7972c92ee..3e1552883 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -54,7 +54,7 @@ except: pass VERSION = '2.3' -BUILD = 8 +BUILD = 9 ## I am not the monster that you think I am.. diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 2c02dc2e8..068f99870 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -18,7 +18,7 @@ import random import string VERSION = '2.3' -BUILD = 8 +BUILD = 9 CENTOS7 = 0 CENTOS8 = 1 diff --git a/serverStatus/views.py b/serverStatus/views.py index 73c1df3b3..12c797283 100755 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -26,7 +26,7 @@ EXPIRE = 3 ### Version VERSION = '2.3' -BUILD = 8 +BUILD = 9 def serverStatusHome(request): From 217dc0dab30f64afcd925592706385ab38c2ad6d Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Nov 2024 14:27:13 +0500 Subject: [PATCH 4/8] bug fix: issues with python packages --- plogical/IncScheduler.py | 2 -- plogical/applicationInstaller.py | 4 ++-- requirments.txt | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 1ee4a8f8f..b42623e32 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -1389,9 +1389,7 @@ Automatic backup failed for %s on %s. @staticmethod def SendTORemote(FileName, RemoteBackupID): - import pysftp import json - import pysftp as sftp from websiteFunctions.models import RemoteBackupConfig try: diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 910e57d09..0f89134dc 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -3015,8 +3015,8 @@ class ApplicationInstaller(multi.Thread): from managePHP.phpManager import PHPManager from websiteFunctions.website import WebsiteManager from packages.models import Package - import pysftp - import pysftp as sftp + #import pysftp + #import pysftp as sftp import boto3 if os.path.exists(ProcessUtilities.debugPath): diff --git a/requirments.txt b/requirments.txt index e0efc946b..c3d63c1c8 100755 --- a/requirments.txt +++ b/requirments.txt @@ -4,7 +4,7 @@ boto3==1.34.153 botocore==1.34.153 cloudflare==2.8.13 cryptography==43.0.0 -cffi==1.14.3 +cffi Django==4.2.14 docker==7.1.0 google-api-core==2.19.1 @@ -14,14 +14,13 @@ google-auth-httplib2==0.2.0 google-auth-oauthlib==1.2.1 googleapis-common-protos==1.63.2 ipaddress==1.0.23 -mysqlclient==2.0.1 +mysqlclient oauthlib==3.2.2 paramiko==3.4.1 pexpect==4.9.0 -psutil==5.7.3 +psutil py3dns==4.0.2 pyOpenSSL==24.2.1 -pysftp==0.2.9 pyotp PyYAML==6.0.1 requests==2.32.3 From ebe2988d6042d3e6bc329cd88f3c135145ffa26d Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Nov 2024 14:29:11 +0500 Subject: [PATCH 5/8] bug fix: issues with python packages --- requirments.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirments.txt b/requirments.txt index c3d63c1c8..46ba92ea7 100755 --- a/requirments.txt +++ b/requirments.txt @@ -2,7 +2,7 @@ bcrypt==4.2.0 beautifulsoup4==4.12.3 boto3==1.34.153 botocore==1.34.153 -cloudflare==2.8.13 +cloudflare cryptography==43.0.0 cffi Django==4.2.14 From 5824196ec8389a5612f51bf1b5f07108aafe94bd Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Nov 2024 15:42:41 +0500 Subject: [PATCH 6/8] bug fix: issues with python packages --- cyberpanel_upgrade.sh | 1 + requirments.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index c5fc84eff..af6456f76 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -548,6 +548,7 @@ fi # shellcheck disable=SC1091 . /usr/local/CyberPanel/bin/activate +pip install --upgrade setuptools packaging Download_Requirement diff --git a/requirments.txt b/requirments.txt index 46ba92ea7..2b93af895 100755 --- a/requirments.txt +++ b/requirments.txt @@ -2,7 +2,7 @@ bcrypt==4.2.0 beautifulsoup4==4.12.3 boto3==1.34.153 botocore==1.34.153 -cloudflare +cloudflare==2.20.0 cryptography==43.0.0 cffi Django==4.2.14 From 4cbbee95a787f3dd9d4d19a76a54678778130042 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Nov 2024 15:43:51 +0500 Subject: [PATCH 7/8] bug fix: issues with python packages --- cyberpanel_upgrade.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index af6456f76..ccd8dd2fb 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -692,6 +692,7 @@ if [ "$Server_OS" = "Ubuntu" ]; then # shellcheck disable=SC1091 . /usr/local/CyberCP/bin/activate Check_Return + pip install --upgrade setuptools packaging pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt Check_Return else From 6f28d39a591b5e08aac6adfcc59b642a58622ea2 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Nov 2024 23:04:14 +0500 Subject: [PATCH 8/8] bug fix: issues with python packages --- cyberpanel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index d361b3171..769e27132 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1060,7 +1060,7 @@ if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]] ; then #!/bin/bash - dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel MariaDB-server MariaDB-client MariaDB-devel curl-devel git platform-python-devel tar socat python3 zip unzip bind-utils gpgme-devel + dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel MariaDB-server MariaDB-client MariaDB-devel curl-devel git platform-python-devel tar socat python3 zip unzip bind-utils gpgme-devel openssl-devel Check_Return elif [[ "$Server_OS_Version" = "20" ]] || [[ "$Server_OS_Version" = "22" ]] ; then dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git python3-devel tar socat python3 zip unzip bind-utils