From c360be953a46ecb75be0aa2cbbf0435f3d0c8c1f Mon Sep 17 00:00:00 2001 From: Mustafa Uzun Date: Wed, 18 Oct 2023 11:57:27 +0300 Subject: [PATCH 01/30] fix: --dbUsername help message --- cli/cliParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cliParser.py b/cli/cliParser.py index bd7ef4231..4ffab040b 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -47,7 +47,7 @@ class cliParser: ## Database Arguments parser.add_argument('--dbName', help='Database name.') - parser.add_argument('--dbUsername', help='Datbase username.') + parser.add_argument('--dbUsername', help='Database username.') parser.add_argument('--dbPassword', help='Database password.') parser.add_argument('--databaseWebsite', help='Database website.') From 290eca1293a7a1af63f65168842617063acb5cde Mon Sep 17 00:00:00 2001 From: xmok <30526133+xmok@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:38:08 +0500 Subject: [PATCH 02/30] make sure TTL is 0-86400 inclusive when add or update --- dns/dnsManager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dns/dnsManager.py b/dns/dnsManager.py index 7142455b6..8746c212f 100755 --- a/dns/dnsManager.py +++ b/dns/dnsManager.py @@ -257,6 +257,10 @@ class DNSManager: recordType = data['recordType'] recordName = data['recordName'] ttl = int(data['ttl']) + if ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") admin = Administrator.objects.get(pk=userID) if ACLManager.checkOwnershipZone(zoneDomain, admin, currentACL) == 1: @@ -444,6 +448,10 @@ class DNSManager: if data['ttlNow'] != None: record.ttl = int(data['ttlNow']) + if record.ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif record.ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") if data['priorityNow'] != None: record.prio = int(data['priorityNow']) @@ -826,6 +834,10 @@ class DNSManager: recordType = data['recordType'] recordName = data['recordName'] ttl = int(data['ttl']) + if ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") admin = Administrator.objects.get(pk=userID) self.admin = admin From 4746945b1c5cbc6fd4c82b7ce30485cbc544e12f Mon Sep 17 00:00:00 2001 From: xmok <30526133+xmok@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:53:13 +0500 Subject: [PATCH 03/30] add min,max to TTL input field in addDeleteDNSRecords --- dns/templates/dns/addDeleteDNSRecords.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dns/templates/dns/addDeleteDNSRecords.html b/dns/templates/dns/addDeleteDNSRecords.html index ddf235262..6fde8f740 100755 --- a/dns/templates/dns/addDeleteDNSRecords.html +++ b/dns/templates/dns/addDeleteDNSRecords.html @@ -88,7 +88,7 @@
-
@@ -114,7 +114,7 @@
-
@@ -141,7 +141,7 @@
-
@@ -167,7 +167,7 @@
-
@@ -199,7 +199,7 @@
-
@@ -226,7 +226,7 @@
-
@@ -253,7 +253,7 @@
-
@@ -280,7 +280,7 @@
-
@@ -307,7 +307,7 @@
-
@@ -337,7 +337,7 @@ ng-model="recordName">
-
From 1c373bd9b3849110febf9496353c09158c0fdc79 Mon Sep 17 00:00:00 2001 From: Mark Honeychurch Date: Mon, 30 Oct 2023 20:14:49 +1300 Subject: [PATCH 04/30] Update cliParser.py Fix typo where "First name" had been replicated --- cli/cliParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cliParser.py b/cli/cliParser.py index bd7ef4231..7427e7f1f 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -58,7 +58,7 @@ class cliParser: ### Additional Arguments for user manager parser.add_argument('--firstName', help='First name while creating user.') - parser.add_argument('--lastName', help='First name while creating user.') + parser.add_argument('--lastName', help='Last name while creating user.') parser.add_argument('--websitesLimit', help='Website limit while creating user.') parser.add_argument('--selectedACL', help='Select ACL while creating user.') parser.add_argument('--securityLevel', help='Set security level while creating user.') From 7c7dbe07fa1e7180cc5a6b41a7a7e80255bf9429 Mon Sep 17 00:00:00 2001 From: Mark Honeychurch Date: Mon, 30 Oct 2023 20:30:56 +1300 Subject: [PATCH 05/30] Update views.py Fix several typos --- userManagment/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userManagment/views.py b/userManagment/views.py index 47dbba044..5e5c20e43 100755 --- a/userManagment/views.py +++ b/userManagment/views.py @@ -135,12 +135,12 @@ def submitUserCreation(request): selectedACL = data['selectedACL'] if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", firstName) == 0: - data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'} + data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain alphabetic characters, and should be more than 2 characters long...'} json_data = json.dumps(data_ret) return HttpResponse(json_data) if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", lastName) == 0: - data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'} + data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'Last Name can only contain alphabetic characters, and should be more than 2 characters long...'} json_data = json.dumps(data_ret) return HttpResponse(json_data) From 329ebfd823d2a3cba51d900c2f766f0be3d4b3c8 Mon Sep 17 00:00:00 2001 From: jderoij Date: Fri, 3 Nov 2023 19:39:30 +0100 Subject: [PATCH 06/30] Update createACL.html Change delete DNS zone in create DNS zone, because that is the function of the piece of code --- userManagment/templates/userManagment/createACL.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userManagment/templates/userManagment/createACL.html b/userManagment/templates/userManagment/createACL.html index 87447d362..1ddf76cd2 100755 --- a/userManagment/templates/userManagment/createACL.html +++ b/userManagment/templates/userManagment/createACL.html @@ -227,7 +227,7 @@
From e84023b1f673c8ea8f0b1ddc0df4e42a4f1908ba Mon Sep 17 00:00:00 2001 From: jderoij Date: Fri, 3 Nov 2023 19:40:41 +0100 Subject: [PATCH 07/30] Update modifyACL.html Change delete DNS zone in Create DNS zone, because the is the function of that piece of code --- userManagment/templates/userManagment/modifyACL.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userManagment/templates/userManagment/modifyACL.html b/userManagment/templates/userManagment/modifyACL.html index 797f9fdfa..59dc6515b 100755 --- a/userManagment/templates/userManagment/modifyACL.html +++ b/userManagment/templates/userManagment/modifyACL.html @@ -231,7 +231,7 @@
From b29bc3988e08b7f5ae6710644b954eac1425e910 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 8 Nov 2023 13:15:55 +0100 Subject: [PATCH 08/30] Update cyberpanel.sh with RHEL and Centos 9 detection --- cyberpanel.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 342f3b96c..d09536420 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -257,8 +257,10 @@ if ! uname -m | grep -qE 'x86_64|aarch64' ; then exit fi -if grep -q -E "CentOS Linux 7|CentOS Linux 8" /etc/os-release ; then +if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then Server_OS="CentOS" +elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then + Server_OS="RedHat" elif grep -q "AlmaLinux-8" /etc/os-release ; then Server_OS="AlmaLinux" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then @@ -271,8 +273,8 @@ elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then Server_OS="openEuler" else echo -e "Unable to detect your system..." - echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n" - Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]" + echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, CentOS 9, RHEL 8, RHEL 9, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n" + Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, CentOS 9, RHEL 8, RHEL 9, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]" exit fi @@ -281,7 +283,7 @@ Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | echo -e "System: $Server_OS $Server_OS_Version detected...\n" -if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then +if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] || [[ "$Server_OS" = "RedHat" ]] ; then Server_OS="CentOS" #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only #treat CloudLinux, Rocky and Alma as CentOS From efebbd024e48d64eeffc4acff9c96d90e8889197 Mon Sep 17 00:00:00 2001 From: vipxr Date: Fri, 10 Nov 2023 01:49:16 +0300 Subject: [PATCH 09/30] Update cPanelImporter.py simpler --- plogical/cPanelImporter.py | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index caa07c140..c1fe4a06e 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -80,38 +80,12 @@ class cPanelImporter: def PHPDecider(self, domainName): - if self.PHPVersion == 'inherit': - self.PHPVersion = 'PHP 7.4' - if self.PHPVersion.find('53') > -1: - self.PHPVersion = 'PHP 5.3' - elif self.PHPVersion.find('54') > -1: - self.PHPVersion = 'PHP 5.4' - elif self.PHPVersion.find('55') > -1: - self.PHPVersion = 'PHP 5.5' - elif self.PHPVersion.find('56') > -1: - self.PHPVersion = 'PHP 5.6' - elif self.PHPVersion.find('70') > -1: - self.PHPVersion = 'PHP 7.0' - elif self.PHPVersion.find('71') > -1: - self.PHPVersion = 'PHP 7.1' - elif self.PHPVersion.find('72') > -1: - self.PHPVersion = 'PHP 7.2' - elif self.PHPVersion.find('73') > -1: - self.PHPVersion = 'PHP 7.3' - elif self.PHPVersion.find('74') > -1: - self.PHPVersion = 'PHP 7.4' - elif self.PHPVersion.find('80') > -1: - self.PHPVersion = 'PHP 8.0' - elif self.PHPVersion.find('81') > -1: - self.PHPVersion = 'PHP 8.1' - elif self.PHPVersion.find('82') > -1: - self.PHPVersion = 'PHP 8.2' - - if self.PHPVersion == '': - if self.InheritPHP != '': - self.PHPVersion = self.InheritPHP - else: - self.PHPVersion = 'PHP 7.4' + if self.PHPVersion == 'inherit' or not self.PHPVersion: + self.PHPVersion = self.InheritPHP or 'PHP 7.4' + else: + version_number = ''.join(filter(str.isdigit, self.PHPVersion)) + if len(version_number) == 2: # Ensure there are exactly two digits + self.PHPVersion = f'PHP {version_number[0]}.{version_number[1]}' ### if the PHP Version extracted from file is not available then change it to next available From be03f8a89a2ca72a4224c0c8354028dd99253978 Mon Sep 17 00:00:00 2001 From: Scott King Date: Fri, 17 Nov 2023 10:51:01 -0700 Subject: [PATCH 10/30] Fix https://github.com/usmannasir/cyberpanel/issues/842 --- cli/cyberPanel.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index 7c34ece6e..45dd7b153 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -124,8 +124,7 @@ class cyberPanel: ipData = f.read() ipAddress = ipData.split('\n', 1)[0] - json_data = "[" - checker = 0 + json_data = [] for items in websites: if items.state == 0: @@ -134,14 +133,8 @@ class cyberPanel: state = "Active" dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress, 'admin': items.admin.userName, 'package': items.package.packageName, 'state': state} + json_data.append(dic) - if checker == 0: - json_data = json_data + json.dumps(dic) - checker = 1 - else: - json_data = json_data + ',' + json.dumps(dic) - - json_data = json_data + ']' final_json = json.dumps(json_data) print(final_json) From 042b858e1ce196c1834d362ea64dc4274e203e10 Mon Sep 17 00:00:00 2001 From: Scott King Date: Fri, 17 Nov 2023 10:58:27 -0700 Subject: [PATCH 11/30] use `with open()` so the file actually gets closed --- cli/cyberPanel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index 45dd7b153..0e3c51f8b 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -120,8 +120,8 @@ class cyberPanel: websites = Websites.objects.all() ipFile = "/etc/cyberpanel/machineIP" - f = open(ipFile) - ipData = f.read() + with open(ipFile, 'r') as f: + ipData = f.read() ipAddress = ipData.split('\n', 1)[0] json_data = [] From 9fda7cd8e155d9190721887cf1f3928d551cf53d Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 10:46:24 +0100 Subject: [PATCH 12/30] Update cyberpanel.sh with CentOS 9 support --- cyberpanel.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index d09536420..1448282bc 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -833,6 +833,19 @@ if [[ $Server_OS = "CentOS" ]] ; then rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo.rpmsave + if [[ "$Server_OS_Version" = "9" ]]; then + grep "Red Hat Enterprise Linux" /etc/os-release >/dev/null + if [[ $? ]] ; then + subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms + yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + Check_Return "yum repo" "no_exit" + else + yum config-manager --set-enabled crb > /dev/null 2>&1 + yum install -y epel-release epel-next-release + Check_Return "yum repo" "no_exit" + fi + fi + if [[ "$Server_OS_Version" = "8" ]]; then rpm --import https://cyberpanel.sh/www.centos.org/keys/RPM-GPG-KEY-CentOS-Official rpm --import https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8 From 36cc1522b63d2655d6b365c79c58964eed1753ab Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 10:54:59 +0100 Subject: [PATCH 13/30] Update install.sh with CentOS 9 support --- install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 426e97cc9..aebb53e97 100644 --- a/install.sh +++ b/install.sh @@ -11,6 +11,15 @@ elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then SERVER_OS="CentOS8" yum install curl wget -y 1> /dev/null yum update curl wget ca-certificates -y 1> /dev/null +elif echo $OUTPUT | grep -q "CentOS Stream" ; then + echo -e "\nDetecting CentOS Stream...\n" + SERVER_OS="CentOS9" +yum update curl wget ca-certificates -y 1> /dev/null +elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux" ; then + echo -e "\nDetecting Red Hat Enterprise Linux...\n" + SERVER_OS="RHEL" + yum install curl wget -y 1> /dev/null +yum update curl wget ca-certificates -y 1> /dev/null elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then echo -e "\nDetecting AlmaLinux 8...\n" SERVER_OS="CentOS8" @@ -56,4 +65,4 @@ rm -f cyberpanel.sh rm -f install.tar.gz curl --silent -o cyberpanel.sh "https://cyberpanel.sh/?dl&$SERVER_OS" 2>/dev/null chmod +x cyberpanel.sh -./cyberpanel.sh $@ \ No newline at end of file +./cyberpanel.sh $@ From 486a80555afaac3a6170ecf0acdd5f20febc202b Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 11:17:56 +0100 Subject: [PATCH 14/30] Update install.sh --- install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index aebb53e97..c3f6420dd 100644 --- a/install.sh +++ b/install.sh @@ -14,11 +14,12 @@ yum update curl wget ca-certificates -y 1> /dev/null elif echo $OUTPUT | grep -q "CentOS Stream" ; then echo -e "\nDetecting CentOS Stream...\n" SERVER_OS="CentOS9" +yum install wget -y 1> /dev/null yum update curl wget ca-certificates -y 1> /dev/null elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux" ; then echo -e "\nDetecting Red Hat Enterprise Linux...\n" SERVER_OS="RHEL" - yum install curl wget -y 1> /dev/null + yum install wget -y 1> /dev/null yum update curl wget ca-certificates -y 1> /dev/null elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then echo -e "\nDetecting AlmaLinux 8...\n" From 0ee2ca5db19c9dec1ac829940901abcb30ea871c Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 11:27:01 +0100 Subject: [PATCH 15/30] Update cyberpanel.sh --- cyberpanel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 1448282bc..2e5ad0021 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -834,7 +834,7 @@ if [[ $Server_OS = "CentOS" ]] ; then rm -f /etc/yum.repos.d/epel.repo.rpmsave if [[ "$Server_OS_Version" = "9" ]]; then - grep "Red Hat Enterprise Linux" /etc/os-release >/dev/null + grep 'NAME="Red Hat Enterprise Linux"' /etc/os-release >/dev/null if [[ $? ]] ; then subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm From 343bc3cf35aab857fbf6f2ca79243308c90555b8 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 11:30:19 +0100 Subject: [PATCH 16/30] Update cyberpanel.sh --- cyberpanel.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 2e5ad0021..de9c7f191 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -834,10 +834,10 @@ if [[ $Server_OS = "CentOS" ]] ; then rm -f /etc/yum.repos.d/epel.repo.rpmsave if [[ "$Server_OS_Version" = "9" ]]; then - grep 'NAME="Red Hat Enterprise Linux"' /etc/os-release >/dev/null + grep "NAME.*Red Hat Enterprise Linux" /etc/os-release >/dev/null if [[ $? ]] ; then subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms - yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm Check_Return "yum repo" "no_exit" else yum config-manager --set-enabled crb > /dev/null 2>&1 From ea23fbb819333d8b1f831c2b65aa1800bc740dd9 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 12:37:18 +0100 Subject: [PATCH 17/30] Update cyberpanel.sh --- cyberpanel.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index de9c7f191..821af74ae 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -834,16 +834,9 @@ if [[ $Server_OS = "CentOS" ]] ; then rm -f /etc/yum.repos.d/epel.repo.rpmsave if [[ "$Server_OS_Version" = "9" ]]; then - grep "NAME.*Red Hat Enterprise Linux" /etc/os-release >/dev/null - if [[ $? ]] ; then - subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm - Check_Return "yum repo" "no_exit" - else - yum config-manager --set-enabled crb > /dev/null 2>&1 - yum install -y epel-release epel-next-release - Check_Return "yum repo" "no_exit" - fi + subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms || yum config-manager --set-enabled crb > /dev/null 2>&1 + yum install -y https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + Check_Return "yum repo" "no_exit" fi if [[ "$Server_OS_Version" = "8" ]]; then @@ -1022,6 +1015,11 @@ if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]] ; then Check_Return dnf install -y gpgme-devel Check_Return + elif [[ "$Server_OS_Version" = "9" ]] ; 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 platform-python-devel tar socat python3 zip unzip bind-utils + Check_Return + dnf install -y gpgme-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 Check_Return @@ -1351,6 +1349,11 @@ if [[ "$Server_OS" = "CentOS" ]] ; then #get this set up beforehand. fi + if [[ "$Server_OS_Version" = "9" ]] ; then + sed -i 's|rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el8.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://rpms.litespeedtech.com/centos/litespeed.repo|g' install.py + sed -i "s|mirrorlist=http://mirrorlist.ghettoforge.org/el/8/gf/\$basearch/mirrorlist|baseurl=https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/9/gf/x86_64/|g" /etc/yum.repos.d/gf.repo + sed -i "s|mirrorlist=http://mirrorlist.ghettoforge.org/el/8/plus/\$basearch/mirrorlist|baseurl=https://cyberpanel.sh/mirror.ghettoforge.org/distributions/gf/el/9/plus/x86_64/|g" /etc/yum.repos.d/gf.repo + fi fi sed -i "s|https://www.litespeedtech.com/|https://cyberpanel.sh/www.litespeedtech.com/|g" installCyberPanel.py @@ -1549,7 +1552,7 @@ fi Post_Install_Addon_Redis() { if [[ "$Server_OS" = "CentOS" ]]; then - if [[ "$Server_OS_Version" = "8" ]]; then + if [[ "$Server_OS_Version" = "8" || "$Server_OS_Version" = "9" ]]; then yum install -y lsphp??-redis redis else yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm From 8d6b6037053632a9f2a0928c76c1459dfc8d5da3 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 12:51:17 +0100 Subject: [PATCH 18/30] Update cyberpanel.sh --- cyberpanel.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index 821af74ae..ed87bfda9 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -837,6 +837,8 @@ if [[ $Server_OS = "CentOS" ]] ; then subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms || yum config-manager --set-enabled crb > /dev/null 2>&1 yum install -y https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm Check_Return "yum repo" "no_exit" + yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm + Check_Return "yum repo" "no_exit" fi if [[ "$Server_OS_Version" = "8" ]]; then From b6f4e7abfc6637ba63af69f4bbda31433e97be1b Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 13:48:29 +0100 Subject: [PATCH 19/30] Update cyberpanel.sh --- cyberpanel.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index ed87bfda9..8fd094876 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -839,6 +839,16 @@ if [[ $Server_OS = "CentOS" ]] ; then Check_Return "yum repo" "no_exit" yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm Check_Return "yum repo" "no_exit" + cat </etc/yum.repos.d/MariaDB.repo +# MariaDB 10.4 CentOS repository list - created 2021-08-06 02:01 UTC +# http://downloads.mariadb.org/mariadb/repositories/ +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.11/rhel9-amd64/ +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +enabled=1 +gpgcheck=1 +EOF fi if [[ "$Server_OS_Version" = "8" ]]; then From cfb172f79142744611de587539a8f9dc8043dab3 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Tue, 21 Nov 2023 14:24:14 +0100 Subject: [PATCH 20/30] Update cyberpanel.sh --- cyberpanel.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 8fd094876..dee4ec7fb 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1028,9 +1028,7 @@ if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]] ; then dnf install -y gpgme-devel Check_Return elif [[ "$Server_OS_Version" = "9" ]] ; 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 platform-python-devel tar socat python3 zip unzip bind-utils - Check_Return - dnf install -y 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 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 From d8768be5a4ac8610421216654c9ec63118f7dba7 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:41:52 +0100 Subject: [PATCH 21/30] Update cyberpanel_utility.sh --- cyberpanel_utility.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 46a67c0ab..2aa90e9ca 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -15,6 +15,10 @@ check_OS() { if grep -q -E "CentOS Linux 7|CentOS Linux 8" /etc/os-release ; then Server_OS="CentOS" + elif grep -q "CentOS Stream" /etc/os-release ; then + Server_OS="CentOS" + elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then + Server_OS="CentOS" elif grep -q "AlmaLinux-8" /etc/os-release ; then Server_OS="AlmaLinux" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then From 31de1fda8347753a469d564f2b226bf7a64daf0f Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:43:23 +0100 Subject: [PATCH 22/30] Update cyberpanel_utility.sh --- cyberpanel_utility.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 2aa90e9ca..92f941f86 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -13,12 +13,10 @@ check_OS() { exit fi - if grep -q -E "CentOS Linux 7|CentOS Linux 8" /etc/os-release ; then - Server_OS="CentOS" - elif grep -q "CentOS Stream" /etc/os-release ; then - Server_OS="CentOS" - elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then - Server_OS="CentOS" + if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then + Server_OS="CentOS" + elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then + Server_OS="RedHat" elif grep -q "AlmaLinux-8" /etc/os-release ; then Server_OS="AlmaLinux" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then From ef069130d5b96d74798af1bc435d461c7e158706 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:44:02 +0100 Subject: [PATCH 23/30] Update cyberpanel_upgrade.sh --- cyberpanel_upgrade.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 7aba557bb..64a5b0778 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -113,7 +113,9 @@ if ! uname -m | grep -qE 'x86_64|aarch64' ; then exit fi -if grep -q -E "CentOS Linux 7|CentOS Linux 8" /etc/os-release ; then +if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then + Server_OS="CentOS" +elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then Server_OS="CentOS" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then Server_OS="CloudLinux" From 53a68498fa25e873efd370c9ac8228c5202dda35 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:44:24 +0100 Subject: [PATCH 24/30] Update cyberpanel_utility.sh --- cyberpanel_utility.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 92f941f86..7dc554a61 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -16,7 +16,7 @@ check_OS() { if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then Server_OS="CentOS" elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then - Server_OS="RedHat" + Server_OS="CentOS" elif grep -q "AlmaLinux-8" /etc/os-release ; then Server_OS="AlmaLinux" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then From 775b65cfddab96e8a36565c857de2517ccce35c8 Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:45:25 +0100 Subject: [PATCH 25/30] Update cyberpanel_upgrade.sh --- cyberpanel_upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 64a5b0778..ae2720ae1 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -116,7 +116,7 @@ fi if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then Server_OS="CentOS" elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then - Server_OS="CentOS" + Server_OS="RedHat" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then Server_OS="CloudLinux" elif grep -q -E "Rocky Linux" /etc/os-release ; then @@ -139,7 +139,7 @@ Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | echo -e "System: $Server_OS $Server_OS_Version detected...\n" -if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then +if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] || [[ "$Server_OS" = "RedHat" ]]; then Server_OS="CentOS" #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only #treat CloudLinux, Rocky and Alma as CentOS From f7eebceb38c7cd545452dcad9f28611974311f5a Mon Sep 17 00:00:00 2001 From: Gergely Lonyai Date: Wed, 22 Nov 2023 17:45:48 +0100 Subject: [PATCH 26/30] Update cyberpanel_utility.sh --- cyberpanel_utility.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 7dc554a61..5b41a2001 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -16,7 +16,7 @@ check_OS() { if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then Server_OS="CentOS" elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then - Server_OS="CentOS" + Server_OS="RedHat" elif grep -q "AlmaLinux-8" /etc/os-release ; then Server_OS="AlmaLinux" elif grep -q -E "CloudLinux 7|CloudLinux 8" /etc/os-release ; then @@ -38,7 +38,7 @@ check_OS() { echo -e "System: $Server_OS $Server_OS_Version detected...\n" - if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then + if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] || [[ "$Server_OS" = "RedHat" ]]; then Server_OS="CentOS" #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only #treat CloudLinux, Rocky and Alma as CentOS From 3fe28cf42f56b63f12d3934a814957485367c613 Mon Sep 17 00:00:00 2001 From: Michael Ramsey Date: Thu, 23 Nov 2023 11:42:15 -0500 Subject: [PATCH 27/30] Update filemanager.py to fix filesize issues Fix filesize issues https://github.com/usmannasir/cyberpanel/issues/146 --- filemanager/filemanager.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index 0608d55f1..be7508b06 100755 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -173,6 +173,15 @@ class FileManager: except: print("Permisson not changed") + + def bytes_to_human_readable(num, suffix='B'): + for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']: + if abs(num) < 1024.0: + return "%3.1f%s%s" % (num, unit, suffix) + num /= 1024.0 + return "%.1f%s%s" % (num, 'Yi', suffix) + + def listForTable(self): try: finalData = {} @@ -221,7 +230,7 @@ class FileManager: if currentFile[0][0] == 'd': dirCheck = 1 - size = str(int(int(currentFile[4]) / float(1024))) + size = bytes_to_human_readable(int(currentFile[4])) lastModified = currentFile[5] + ' ' + currentFile[6] + ' ' + currentFile[7] finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0], dirCheck] From 4f5f22203c894f72b324129b76e3f2c8077ec172 Mon Sep 17 00:00:00 2001 From: Michael Ramsey Date: Thu, 23 Nov 2023 11:44:44 -0500 Subject: [PATCH 28/30] Update index.html to not have hardcoded KB size --- filemanager/templates/filemanager/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filemanager/templates/filemanager/index.html b/filemanager/templates/filemanager/index.html index 42ccc22bd..464a61a4e 100755 --- a/filemanager/templates/filemanager/index.html +++ b/filemanager/templates/filemanager/index.html @@ -153,7 +153,7 @@ {% trans "File Name" %} - {% trans "Size (KB)" %} + {% trans "Size" %} {% trans "Last Modified" %} {% trans "Permissions" %} @@ -738,4 +738,4 @@ - \ No newline at end of file + From 21dc6393f523e48c5b9fd07ad76065ffb00d127a Mon Sep 17 00:00:00 2001 From: Michael Ramsey Date: Thu, 23 Nov 2023 12:43:19 -0500 Subject: [PATCH 29/30] Update filemanager.py revert python side changes --- filemanager/filemanager.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index be7508b06..9fff1f51f 100755 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -172,14 +172,6 @@ class FileManager: ProcessUtilities.executioner(command, website.externalApp) except: print("Permisson not changed") - - - def bytes_to_human_readable(num, suffix='B'): - for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']: - if abs(num) < 1024.0: - return "%3.1f%s%s" % (num, unit, suffix) - num /= 1024.0 - return "%.1f%s%s" % (num, 'Yi', suffix) def listForTable(self): @@ -230,7 +222,7 @@ class FileManager: if currentFile[0][0] == 'd': dirCheck = 1 - size = bytes_to_human_readable(int(currentFile[4])) + size = str(int(int(currentFile[4]) / float(1024))) lastModified = currentFile[5] + ' ' + currentFile[6] + ' ' + currentFile[7] finalData[str(counter)] = [currentFile[-1], currentFile[-1], lastModified, size, currentFile[0], dirCheck] From a96144f1d6a5551120a16c9dff0798e68e6a2828 Mon Sep 17 00:00:00 2001 From: Michael Ramsey Date: Thu, 23 Nov 2023 12:44:36 -0500 Subject: [PATCH 30/30] Update fileManager.js Switched logic to js side where it works --- .../static/filemanager/js/fileManager.js | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/filemanager/static/filemanager/js/fileManager.js b/filemanager/static/filemanager/js/fileManager.js index 37c2f47ed..e73bed091 100755 --- a/filemanager/static/filemanager/js/fileManager.js +++ b/filemanager/static/filemanager/js/fileManager.js @@ -14,6 +14,28 @@ function getCookie(name) { return cookieValue; } +// JavaScript function to convert bytes to a human-readable format +function bytesToHumanReadable(bytes, suffix = 'B') { + let units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']; + let i = 0; + while (Math.abs(bytes) >= 1024 && i < units.length - 1) { + bytes /= 1024; + ++i; + } + return bytes.toFixed(1) + units[i] + suffix; +} + +// JavaScript function to convert kilobytes to a human-readable format +function kilobytesToHumanReadable(kilobytes, suffix = 'KB') { + let units = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + let i = 0; + while (Math.abs(kilobytes) >= 1024 && i < units.length - 1) { + kilobytes /= 1024; + ++i; + } + return kilobytes.toFixed(2) + ' ' + units[i]; +} + var fileManager = angular.module('fileManager', ['angularFileUpload']); fileManager.config(['$interpolateProvider', function ($interpolateProvider) { @@ -721,7 +743,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, } else { var fileName = filesData[keys[i]][0]; var lastModified = filesData[keys[i]][2]; - var fileSize = filesData[keys[i]][3]; + var fileSizeBytes = parseInt(filesData[keys[i]][3], 10); // Assuming this is the size in kilobytes + var fileSize = kilobytesToHumanReadable(fileSizeBytes); // Convert to human-readable format var permissions = filesData[keys[i]][4]; var dirCheck = filesData[keys[i]][5]; // console.log(fileName);