From e9a4cb2f56dab447487f7ebf208fdb2e357d79cc Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 12 Feb 2024 11:18:36 +0500 Subject: [PATCH 01/13] add doc links for sub/addon domain --- .../templates/websiteFunctions/createDomain.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index 80914250c..c5f0cafb4 100755 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -93,7 +93,11 @@
-

{% trans "Create Sub/Addon Domain" %}

+

{% trans "Create Sub/Addon Domain" %} - {% trans "Learn about Sub/Addon Domains" %}

{% trans "Create Sub/Addon domains. " %}

From 44758dd5bbd88efcc31be69a6cd0c99863743e70 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Tue, 13 Feb 2024 09:39:33 +0500 Subject: [PATCH 02/13] bug fix: cloudlinux script --- CLScript/CloudLinuxDomains.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CLScript/CloudLinuxDomains.py b/CLScript/CloudLinuxDomains.py index 8f0355394..e9d8b2811 100755 --- a/CLScript/CloudLinuxDomains.py +++ b/CLScript/CloudLinuxDomains.py @@ -17,10 +17,11 @@ from CLScript.CLMain import CLMain class CloudLinuxDomains(CLMain): - def __init__(self, name, owner): + def __init__(self, name, owner, with_php): CLMain.__init__(self) self.owner = owner self.name = name + self.with_php = with_php def listAll(self): data = {} @@ -47,16 +48,20 @@ class CloudLinuxDomains(CLMain): print(json.dumps(final)) +import argparse + if __name__ == '__main__': parser = argparse.ArgumentParser(description='CyberPanel CloudLinux Manager') parser.add_argument('-o', '--owner', help='Owner') parser.add_argument('-n', '--name', help='Owner') - parser.add_argument('-p', '--with-php', help='False (X-Ray support only)') + parser.add_argument('-p', '--with-php', action='store_true', help='False (X-Ray support only)') args = parser.parse_args() - pi = CloudLinuxDomains(args.name, args.owner) + # Assuming CloudLinuxDomains class exists + pi = CloudLinuxDomains(args.name, args.owner, args.with_php) try: pi.listAll() except: pi.listAll() + From 565e5ca8b673fa01e02ff178179dcbb81dbf21aa Mon Sep 17 00:00:00 2001 From: usmannasir Date: Tue, 13 Feb 2024 22:53:34 +0500 Subject: [PATCH 03/13] some changes to onboarding --- plogical/virtualHostUtilities.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 17ba04849..a12378e29 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -76,12 +76,17 @@ class virtualHostUtilities: except: CurrentHostName = '' - if not skipRDNSCheck: - if not os.path.exists('/home/cyberpanel/postfix'): + if skipRDNSCheck: + pass + else: + if os.path.exists('/home/cyberpanel/postfix'): + pass + else: message = 'This server does not come with postfix installed. [404]' print(message) logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, message) logging.CyberCPLogFileWriter.writeToFile(message) + return 0 #### From 3e552d911d9bb21d1734f21966663f5c2359a92f Mon Sep 17 00:00:00 2001 From: usmannasir Date: Tue, 13 Feb 2024 23:00:13 +0500 Subject: [PATCH 04/13] bug fix: only list actual branch names --- baseTemplate/templates/baseTemplate/versionManagment.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/baseTemplate/templates/baseTemplate/versionManagment.html b/baseTemplate/templates/baseTemplate/versionManagment.html index 933030bf2..5cab4cbe9 100755 --- a/baseTemplate/templates/baseTemplate/versionManagment.html +++ b/baseTemplate/templates/baseTemplate/versionManagment.html @@ -123,7 +123,9 @@ var option = document.createElement("option"); option.value = branch; option.text = branch; - branchSelect.appendChild(option); + if (branch.startsWith("v") && branch.indexOf("dev") === -1) { + branchSelect.appendChild(option); + } }); } From 7bb94f0b5a01240f00780bfe1aeb84a52406d22e Mon Sep 17 00:00:00 2001 From: usmannasir Date: Tue, 13 Feb 2024 23:15:51 +0500 Subject: [PATCH 05/13] bug fix: only list actual branch names --- baseTemplate/templates/baseTemplate/versionManagment.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/versionManagment.html b/baseTemplate/templates/baseTemplate/versionManagment.html index 5cab4cbe9..59c9ed28f 100755 --- a/baseTemplate/templates/baseTemplate/versionManagment.html +++ b/baseTemplate/templates/baseTemplate/versionManagment.html @@ -119,14 +119,16 @@ // Function to populate the branch dropdown function populateBranches(branches) { var branchSelect = document.getElementById("branchSelect"); - branches.forEach((branch) => { + for (let i = branches.length - 1; i >= 0; i--) { + const branch = branches[i]; var option = document.createElement("option"); option.value = branch; option.text = branch; - if (branch.startsWith("v") && branch.indexOf("dev") === -1) { + if (branch.startsWith("v") && branch.indexOf("dev") === -1 && branch.indexOf("version-counter") === -1) { branchSelect.appendChild(option); } - }); + } + } function getBranches(url, branches, page) { From b87bfcb71b01130f7924c30838b4528b4fe0af69 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 14 Feb 2024 12:00:57 +0500 Subject: [PATCH 06/13] bug fix: show php version in search ref https://www.facebook.com/groups/cyberpanel/posts/3503730543271902/ --- websiteFunctions/website.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 31e243d9f..55b901d16 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4602,10 +4602,21 @@ StrictHostKeyChecking no DiskUsage, DiskUsagePercentage, bwInMB, bwUsage = virtualHostUtilities.FindStats(items) + vhFile = f'/usr/local/lsws/conf/vhosts/{items.domain}/vhost.conf' + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(vhFile) + + try: + from plogical.phpUtilities import phpUtilities + PHPVersionActual = phpUtilities.WrapGetPHPVersionFromFileToGetVersionWithPHP(vhFile) + except: + PHPVersionActual = 'PHP 8.1' + diskUsed = "%sMB" % str(DiskUsage) dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress, 'admin': items.admin.userName, 'package': items.package.packageName, 'state': state, - 'diskUsed': diskUsed} + 'diskUsed': diskUsed, 'phpVersion': PHPVersionActual} if checker == 0: json_data = json_data + json.dumps(dic) From 83870baea15f3b9f1eef58e4c2832d8ed9f8eaa4 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 14 Feb 2024 21:46:55 +0500 Subject: [PATCH 07/13] bug fix: docker problem with csf: ref https://community.cyberpanel.net/t/docker-and-csf-problems/52284/2 --- plogical/DockerSites.py | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index a58c0ee56..d1c8556bc 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -3,6 +3,8 @@ import json import os import sys import time +from random import randint + sys.path.append('/usr/local/CyberCP') try: @@ -44,6 +46,60 @@ class Docker_Sites(multi.Thread): except: pass + command = 'cat /etc/csf/csf.conf' + result = ProcessUtilities.outputExecutioner(command) + + if result.find('SECTION:Initial Settings') > -1: + + from plogical.csf import CSF + from plogical.virtualHostUtilities import virtualHostUtilities + currentSettings = CSF.fetchCSFSettings() + + tcpIN = currentSettings['tcpIN'] + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'TCPIN docker: {tcpIN}') + + + + if tcpIN.find('8088') == -1: + + ports = f'{tcpIN},8088' + + portsPath = '/home/cyberpanel/' + str(randint(1000, 9999)) + + if os.path.exists(portsPath): + os.remove(portsPath) + + writeToFile = open(portsPath, 'w') + writeToFile.write(ports) + writeToFile.close() + + execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = execPath + f" modifyPorts --protocol TCP_IN --ports " + portsPath + ProcessUtilities.executioner(execPath) + + tcpOUT = currentSettings['tcpOUT'] + if tcpOUT.find('8088') == -1: + + ports = f'{tcpOUT},8088' + + portsPath = '/home/cyberpanel/' + str(randint(1000, 9999)) + + if os.path.exists(portsPath): + os.remove(portsPath) + + writeToFile = open(portsPath, 'w') + writeToFile.write(ports) + writeToFile.close() + + execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = execPath + f" modifyPorts --protocol TCP_OUT --ports " + portsPath + ProcessUtilities.executioner(execPath) + + + + def run(self): try: if self.function_run == 'DeployWPContainer': From 75c4c0c28b195266e8f1456b6fc7b6d673855659 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 15 Feb 2024 05:19:10 +0500 Subject: [PATCH 08/13] bug fix: create subdomain pageg --- baseTemplate/templates/baseTemplate/index.html | 2 +- websiteFunctions/templates/websiteFunctions/createDomain.html | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 887036790..45d6b3080 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -77,7 +77,7 @@ - {% with version="2.3.5.2" %} + {% with version="2.3.5.3" %} diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index c5f0cafb4..580ae961c 100755 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -97,11 +97,10 @@ href="https://cyberpanel.net/KnowledgeBase/home/create-sub-addon-domain/" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" - title="">{% trans "Learn about Sub/Addon Domains" %} + title="">{% trans "Learn about Sub/Addon Domains" %}

{% trans "Create Sub/Addon domains. " %}

-

From 3f6e8ab4040cefaa2dfc4a0b5f6d48d495c5aadd Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 15 Feb 2024 05:53:56 +0500 Subject: [PATCH 09/13] bug fix: docker problem with csf: ref https://community.cyberpanel.net/t/docker-and-csf-problems/52284/2 --- plogical/csf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plogical/csf.py b/plogical/csf.py index a2eca9ff0..f0fc56ffa 100755 --- a/plogical/csf.py +++ b/plogical/csf.py @@ -160,10 +160,10 @@ def configservercsfiframe(request): for items in data: if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines( - 'TCP_IN = "20,21,22,25,53,80,110,995,143,443,465,587,993,995,1025,7080,8090,40110:40210"\n') + 'TCP_IN = "20,21,22,25,53,80,110,995,143,443,465,587,993,995,1025,7080,8090,40110:40210,8088,5678"\n') elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines( - 'TCP_OUT = "20,21,22,25,43,53,80,110,113,443,587,993,995,8090,40110:40210"\n') + 'TCP_OUT = "20,21,22,25,43,53,80,110,113,443,587,993,995,8090,40110:40210,8088,5678"\n') elif items.find('UDP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'): writeToConf.writelines('UDP_IN = "20,21,53,443"\n') elif items.find('UDP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'): From 426975e37f18cd04f5e12cb5c691d5541a2e4873 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 18 Feb 2024 11:28:01 +0500 Subject: [PATCH 10/13] bug fix: fetch emails ref https://github.com/usmannasir/cyberpanel/issues/1222 --- mailServer/mailserverManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index c4aa2e1d2..36c79021b 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -542,7 +542,7 @@ class MailServerManager(multi.Thread): for items in records: dic = {'email': items.email, - 'DiskUsage': '%sMB' % items.DiskUsage + 'DiskUsage': '%sMB' % items.DiskUsage.rstrip('MB') } if checker == 0: From d610fd90f927849428e0ca3d8724cfcf30bd2314 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 18 Feb 2024 12:58:48 +0500 Subject: [PATCH 11/13] bug fix mariadb install on cloudlinux ref https://github.com/usmannasir/cyberpanel/issues/1219 --- install/installCyberPanel.py | 47 ++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index ae70929f6..dc0acdbe3 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -37,6 +37,16 @@ def get_Ubuntu_release(): return release +def FetchCloudLinuxVersion(): + if os.path.exists('/etc/os-release'): + data = open('/etc/os-release', 'r').read() + if (data.find('CloudLinux') > -1 or data.find('cloudlinux') > -1) and (data.find('8.9') > -1 or data.find('Anatoly Levchenko') > -1): + return 89 + elif (data.find('CloudLinux') > -1 or data.find('cloudlinux') > -1) and (data.find('8.8') > -1 or data.find('Anatoly Filipchenko') > -1): + return 88 + else: + return -1 + class InstallCyberPanel: mysql_Root_password = "" mysqlPassword = "" @@ -349,17 +359,38 @@ gpgcheck=1 command = 'dnf install mariadb-server -y' elif self.distro == cent8 or self.distro == openeuler: - command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.11' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + if FetchCloudLinuxVersion() >= 88: + repo = '/etc/yum.repos.d/mariadb.repo' + repoContent = ''' +# MariaDB 10.11 RedHatEnterpriseLinux repository list - created 2023-10-30 14:19 UTC +# https://mariadb.org/download/ +[mariadb] +name = MariaDB +# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for$ +# baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch +baseurl = https://mirror.23m.com/mariadb/yum/10.11/rhel/$releasever/$basearch +module_hotfixes = 1 +# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB +gpgkey = https://mirror.23m.com/mariadb/yum/RPM-GPG-KEY-MariaDB +gpgcheck = 1 +''' + WriteToFile = open(repo, 'w') + WriteToFile.write(repoContent) + WriteToFile.close() - command = 'yum remove mariadb* -y' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + else: - command = 'sudo dnf -qy module disable mariadb' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.11' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) - command = 'sudo dnf module reset mariadb -y' - install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + command = 'yum remove mariadb* -y' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + + command = 'sudo dnf -qy module disable mariadb' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) + + command = 'sudo dnf module reset mariadb -y' + install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) command = 'dnf install MariaDB-server MariaDB-client MariaDB-backup -y' From dde58e1368928ecb3d33e1ed07de9ac04c0057c3 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 18 Feb 2024 13:31:50 +0500 Subject: [PATCH 12/13] bug fix mariadb install on cloudlinux ref https://github.com/usmannasir/cyberpanel/issues/1219 --- cyberpanel.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cyberpanel.sh b/cyberpanel.sh index 51bac4176..3a3e2cbe4 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -863,6 +863,15 @@ EOF dnf config-manager --set-enabled PowerTools > /dev/null 2>&1 dnf config-manager --set-enabled powertools > /dev/null 2>&1 + + cat </etc/yum.repos.d/MariaDB.repo +[mariadb] +name = MariaDB +baseurl = https://rpm.mariadb.org/10.6/rhel/\$releasever/\$basearch +gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +EOF + # cat </etc/yum.repos.d/CentOS-PowerTools-CyberPanel.repo #[powertools-for-cyberpanel] From e259dff4f100ee42607cd0e285d3b0acbd9e2ad2 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 18 Feb 2024 13:33:49 +0500 Subject: [PATCH 13/13] bug fix mariadb install on cloudlinux ref https://github.com/usmannasir/cyberpanel/issues/1219 --- install/installCyberPanel.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index dc0acdbe3..9643ea94f 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -362,17 +362,11 @@ gpgcheck=1 if FetchCloudLinuxVersion() >= 88: repo = '/etc/yum.repos.d/mariadb.repo' repoContent = ''' -# MariaDB 10.11 RedHatEnterpriseLinux repository list - created 2023-10-30 14:19 UTC -# https://mariadb.org/download/ [mariadb] name = MariaDB -# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for$ -# baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch -baseurl = https://mirror.23m.com/mariadb/yum/10.11/rhel/$releasever/$basearch -module_hotfixes = 1 -# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB -gpgkey = https://mirror.23m.com/mariadb/yum/RPM-GPG-KEY-MariaDB -gpgcheck = 1 +baseurl = https://rpm.mariadb.org/10.6/rhel/$releasever/$basearch +gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 ''' WriteToFile = open(repo, 'w') WriteToFile.write(repoContent)