From f3023a048c6649fc727d627ba325b97c19e6fe9a Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 14 Nov 2022 13:09:56 +0500 Subject: [PATCH 01/20] remove php 71 --- install/install.py | 4 ++-- plogical/upgrade.py.bak | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install/install.py b/install/install.py index b2c43ab5b..8868df497 100755 --- a/install/install.py +++ b/install/install.py @@ -1988,8 +1988,8 @@ milter_default_action = accept if os.access('/usr/local/lsws/lsphp72/bin/php7.2', os.R_OK): os.symlink('/usr/local/lsws/lsphp72/bin/php7.2', '/usr/local/lsws/lsphp72/bin/php') - command = "cp /usr/local/lsws/lsphp71/bin/php /usr/bin/" - preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + #command = "cp /usr/local/lsws/lsphp71/bin/php /usr/bin/" + #preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) os.chdir(self.cwd) diff --git a/plogical/upgrade.py.bak b/plogical/upgrade.py.bak index ae82dba27..869740ef6 100644 --- a/plogical/upgrade.py.bak +++ b/plogical/upgrade.py.bak @@ -2181,8 +2181,8 @@ echo $oConfig->Save() ? 'Done' : 'Error'; CentOSPath = '/etc/redhat-release' if not os.path.exists(CentOSPath): - command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' - Upgrade.executioner(command, 'Set default PHP 7.0, 0') + #command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' + #Upgrade.executioner(command, 'Set default PHP 7.0, 0') @staticmethod def someDirectories(): From 0cfa837f0302de2dcc3a051d7aca6d976e02e4e9 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 14 Nov 2022 13:50:27 +0500 Subject: [PATCH 02/20] remove php 71 --- plogical/upgrade.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 9da9b6c0e..327be11e0 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2339,9 +2339,10 @@ echo $oConfig->Save() ? 'Done' : 'Error'; CentOSPath = '/etc/redhat-release' openEulerPath = '/etc/openEuler-release' - if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath): - command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' - Upgrade.executioner(command, 'Set default PHP 7.0, 0') + #if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath): + #command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' + #Upgrade.executioner(command, 'Set default PHP 7.0, 0') + @staticmethod def someDirectories(): From db30e73d26cec54cb73f44702f758107682564b7 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 21 Nov 2022 15:08:15 +0500 Subject: [PATCH 03/20] minor bug fix --- .../websiteFunctions/CyberpanelPricing.html | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html index 8955cc04b..b253b8fd3 100644 --- a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html +++ b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html @@ -8,15 +8,18 @@

Managing Your WordPress sites was never so easy!

-

43% of all Websites on the Internet are built with WordPress, so +

43% of all Websites on the Internet are built with + WordPress, so it deserves some love! With CyberPanel WordPress Manager, you can easily Monitor, Analyze, Optimize and keep your website in Top-Notch performance, all the time.

@@ -32,16 +35,19 @@ - + +
-
+

Features You’ll Love

-
+
@@ -57,7 +63,7 @@
-
+
@@ -75,7 +81,7 @@
-
+
@@ -142,7 +148,6 @@
-
From 667cf962b0d2672558974a9abdad62d714480592 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 21 Nov 2022 15:08:28 +0500 Subject: [PATCH 04/20] minor bug fix --- plogical/upgrade.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 327be11e0..d12602281 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2343,7 +2343,6 @@ echo $oConfig->Save() ? 'Done' : 'Error'; #command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' #Upgrade.executioner(command, 'Set default PHP 7.0, 0') - @staticmethod def someDirectories(): command = "mkdir -p /usr/local/lscpd/admin/" From 7dbb306571529ee41dc3cb10a5bb7b2c94ebad08 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 21 Nov 2022 15:38:03 +0500 Subject: [PATCH 05/20] minor bug fix --- websiteFunctions/templates/websiteFunctions/WPCreate.html | 2 +- websiteFunctions/templates/websiteFunctions/WPsiteHome.html | 2 +- websiteFunctions/templates/websiteFunctions/createDomain.html | 2 +- websiteFunctions/templates/websiteFunctions/createWebsite.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/websiteFunctions/templates/websiteFunctions/WPCreate.html b/websiteFunctions/templates/websiteFunctions/WPCreate.html index b32c5b86c..643420e70 100644 --- a/websiteFunctions/templates/websiteFunctions/WPCreate.html +++ b/websiteFunctions/templates/websiteFunctions/WPCreate.html @@ -204,7 +204,7 @@ class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
Looks like you have not subscripted to temporary domain feature,Looks like you have not subscribed to temporary domain feature,click here for more details.
diff --git a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html index 2dd80c57c..229b1fa8c 100644 --- a/websiteFunctions/templates/websiteFunctions/WPsiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/WPsiteHome.html @@ -452,7 +452,7 @@ class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
Looks like you have not subscripted to temporary domain feature, +
Looks like you have not subscribed to temporary domain feature, click here for more details. diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index 5e8937ada..551d06fd9 100755 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -196,7 +196,7 @@ class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
Looks like you have not subscripted to temporary domain feature, Looks like you have not subscribed to temporary domain feature, click here for more details.
diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index a6c2ebba3..0f7ca84b5 100755 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -187,7 +187,7 @@ class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
Looks like you have not subscripted to temporary domain feature, Looks like you have not subscribed to temporary domain feature, click here for more details.
From 383bd832acbc56f0536683c4bb6010ea4fefcb82 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 21 Nov 2022 21:28:37 +0500 Subject: [PATCH 06/20] minor bug fix --- baseTemplate/templates/baseTemplate/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 0f0c34537..84d36451c 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -77,7 +77,7 @@ - {% with version="2.3.2.2" %} + {% with version="2.3.2.3" %} From 6733f7f3cd501cbb6d3b906f6dd12a9250f79066 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sat, 26 Nov 2022 15:25:22 +0500 Subject: [PATCH 07/20] add docs --- websiteFunctions/templates/websiteFunctions/sshAccess.html | 2 +- websiteFunctions/templates/websiteFunctions/website.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/websiteFunctions/templates/websiteFunctions/sshAccess.html b/websiteFunctions/templates/websiteFunctions/sshAccess.html index fbb51df08..75305fea1 100755 --- a/websiteFunctions/templates/websiteFunctions/sshAccess.html +++ b/websiteFunctions/templates/websiteFunctions/sshAccess.html @@ -18,7 +18,7 @@

{% trans "Set up SSH access for " %} {{ domainName }}. + src="{% static 'images/loading.gif' %}"> - SFTP Docs

diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index 0fe44e518..532de9a97 100755 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -33,7 +33,7 @@ class="btn btn-border btn-alt border-azure btn-link font-azure" href="/websites/{{ domain }}/setupStaging" title="">{% trans "Clone/Staging" %} {% trans "Set up SSH Access" %} + href="/websites/{{ domain }}/sshAccess" title="">{% trans "Set up SSH/SFTP Access" %} {% trans "Stress Test" %} From 6ec0cca18ab71eaa25a0d4322efeb8051cf39924 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sat, 3 Dec 2022 16:49:27 +0500 Subject: [PATCH 08/20] resolve https://github.com/usmannasir/cyberpanel/issues/998 --- packages/packagesManager.py | 10 ++++++++++ plogical/IncScheduler.py | 11 ++++++++--- websiteFunctions/website.py | 11 +++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/packages/packagesManager.py b/packages/packagesManager.py index f6ebc9fba..c5893bd7e 100755 --- a/packages/packagesManager.py +++ b/packages/packagesManager.py @@ -211,6 +211,16 @@ class PackagesManager: modifyPack.save() + ## Fix https://github.com/usmannasir/cyberpanel/issues/998 + + # from plogical.IncScheduler import IncScheduler + # isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) + # isPU.start() + + from plogical.processUtilities import ProcessUtilities + command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce' + ProcessUtilities.outputExecutioner(command) + data_ret = {'status': 1, 'saveStatus': 1, 'error_message': "None"} json_data = json.dumps(data_ret) return HttpResponse(json_data) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 2462ddea0..33694e41d 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -1,11 +1,9 @@ #!/usr/local/CyberCP/bin/python import os.path import sys - sys.path.append('/usr/local/CyberCP') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") import django - django.setup() from IncBackups.IncBackupsControl import IncJobs from IncBackups.models import BackupJob @@ -56,8 +54,11 @@ class IncScheduler(multi.Thread): self.data = extraArgs def run(self): - if self.function == 'startBackup': + if self.function == "startBackup": IncScheduler.startBackup(self.data['freq']) + elif self.function == "CalculateAndUpdateDiskUsage": + logging.writeToFile('called CalculateAndUpdateDiskUsage etc') + IncScheduler.CalculateAndUpdateDiskUsage() @staticmethod def startBackup(type): @@ -1369,6 +1370,10 @@ def main(): parser.add_argument('--planName', help='Plan name for AWS!') args = parser.parse_args() + if args.function == 'UpdateDiskUsageForce': + IncScheduler.CalculateAndUpdateDiskUsage() + return 0 + if args.function == '30 Minutes' or args.function == '30 Minutes' or args.function == '1 Hour' or args.function == '6 Hours' or args.function == '12 Hours' or args.function == '1 Day' or args.function == '3 Days' or args.function == '1 Week': IncScheduler.RemoteBackup(args.function) return 0 diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 9edb94b3e..9d19988ce 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -2796,6 +2796,17 @@ class WebsiteManager: modifyWeb.save() + ## Fix https://github.com/usmannasir/cyberpanel/issues/998 + + # from plogical.IncScheduler import IncScheduler + # isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) + # isPU.start() + + command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce' + ProcessUtilities.outputExecutioner(command) + + ## + data_ret = {'status': 1, 'saveStatus': 1, 'error_message': "None"} json_data = json.dumps(data_ret) return HttpResponse(json_data) From 77f331f28090c035167d01daa8d1c05bf1e6cb80 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sat, 3 Dec 2022 16:50:53 +0500 Subject: [PATCH 09/20] resolve https://github.com/usmannasir/cyberpanel/issues/998 --- plogical/IncScheduler.py | 1 - websiteFunctions/website.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 33694e41d..85472a8a8 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -57,7 +57,6 @@ class IncScheduler(multi.Thread): if self.function == "startBackup": IncScheduler.startBackup(self.data['freq']) elif self.function == "CalculateAndUpdateDiskUsage": - logging.writeToFile('called CalculateAndUpdateDiskUsage etc') IncScheduler.CalculateAndUpdateDiskUsage() @staticmethod diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 9d19988ce..34e3839f6 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -2799,8 +2799,8 @@ class WebsiteManager: ## Fix https://github.com/usmannasir/cyberpanel/issues/998 # from plogical.IncScheduler import IncScheduler - # isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) - # isPU.start() + isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) + isPU.start() command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce' ProcessUtilities.outputExecutioner(command) From 1411dbf29763226732bb8b3b9873f5748ce009a0 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Tue, 6 Dec 2022 14:34:49 +0500 Subject: [PATCH 10/20] bug fix: when backup taken from openlitespeed is restored on lsws ent server, it created an issue --- plogical/backupUtilities.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index b61984d07..1d3128dce 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -776,6 +776,15 @@ class backupUtilities: 1] + ". Not able to create Account, Databases and DNS Records, aborting. [575][5009]") return 0 + #### Find out web server from backup conf + + CurrentServer = ProcessUtilities.OLS + + if os.path.exists(completPath + '/vhost.conf'): + if open(f'{completPath}/vhost.conf', 'r').read().find('ServerName') > -1: + CurrentServer = ProcessUtilities.ent + + ########### Creating child/sub/addon/parked domains logging.CyberCPLogFileWriter.statusWriter(status, "Creating Child Domains!") @@ -819,7 +828,8 @@ class backupUtilities: if os.path.exists(completPath + '/' + domain + '.vhost.conf'): completPathToConf = backupUtilities.Server_root + '/conf/vhosts/' + domain + '/vhost.conf' - copy(completPath + '/' + domain + '.vhost.conf', completPathToConf) + if CurrentServer == ProcessUtilities.decideServer(): + copy(completPath + '/' + domain + '.vhost.conf', completPathToConf) sslStoragePath = completPath + "/" + domain + ".cert.pem" @@ -1030,7 +1040,8 @@ class backupUtilities: completPathToConf = backupUtilities.Server_root + '/conf/vhosts/' + masterDomain + '/vhost.conf' if os.path.exists(completPath + '/vhost.conf'): - copy(completPath + '/vhost.conf', completPathToConf) + if CurrentServer == ProcessUtilities.decideServer(): + copy(completPath + '/vhost.conf', completPathToConf) logging.CyberCPLogFileWriter.statusWriter(status, "Done") From ee02304508e96978e1d5a210cff205859e9e61fc Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Tue, 13 Dec 2022 19:23:34 +0500 Subject: [PATCH 11/20] bug fix: cPanel importer --- plogical/cPanelImporter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index d88cc7477..6d9d4dc64 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -102,6 +102,8 @@ class cPanelImporter: 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' if self.PHPVersion == '': if self.InheritPHP != '': From 76fcfb2e9b2a8f3ec4c535334bc05b8757113f27 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Wed, 21 Dec 2022 20:35:28 +0500 Subject: [PATCH 12/20] bug fix: https://github.com/coreruleset/coreruleset/issues/2762 --- plogical/modSec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plogical/modSec.py b/plogical/modSec.py index e8b499ca1..d92e62d06 100755 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -320,8 +320,8 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf for items in confData: if items.find('/usr/local/lsws/conf/modsec/rules.conf') > -1: - conf.writelines(items) conf.write(owaspRulesConf) + conf.writelines(items) continue else: conf.writelines(items) From 4c051dbf2f61798a852ebeab5284d98c75e20d79 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Tue, 27 Dec 2022 21:06:05 +0500 Subject: [PATCH 13/20] bug fix: https://github.com/usmannasir/cyberpanel/issues/1012 --- install/install.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/install/install.py b/install/install.py index 8868df497..9e7250b54 100755 --- a/install/install.py +++ b/install/install.py @@ -1368,6 +1368,22 @@ autocreate_system_folders = On pass return True + + def findSSHPort(self): + try: + sshData = subprocess.check_output(shlex.split('cat /etc/ssh/sshd_config')).decode("utf-8").split('\n') + + for items in sshData: + if items.find('Port') > -1: + if items[0] == 0: + pass + else: + return items.split(' ')[1] + + return '22' + except BaseException as msg: + return '22' + def installFirewalld(self): if self.distro == ubuntu: @@ -1417,6 +1433,15 @@ autocreate_system_folders = On FirewallUtilities.addRule("udp", "443") FirewallUtilities.addRule("tcp", "40110-40210") + try: + SSHPort = self.findSSHPort() + if SSHPort != '22': + FirewallUtilities.addRule('tcp', SSHPort) + except BaseException as msg: + logging.InstallLog.writeToFile(f'[Error Custom SSH port] {str(msg)}') + preFlightsChecks.stdOut(f'[Error Custom SSH port] {str(msg)}') + + logging.InstallLog.writeToFile("FirewallD installed and configured!") preFlightsChecks.stdOut("FirewallD installed and configured!") From 698b71a0def61e295559f7738da51af84684ca4c Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Fri, 30 Dec 2022 21:04:35 +0500 Subject: [PATCH 14/20] bug fix: https://www.facebook.com/groups/cyberpanel/posts/3234831330161826/ --- plogical/IncScheduler.py | 6 ---- plogical/modSec.py | 37 +++++++++++++------ websiteFunctions/website.py | 72 ++++++++++++++++++++----------------- 3 files changed, 65 insertions(+), 50 deletions(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 85472a8a8..2b5d5a9c1 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -1352,12 +1352,6 @@ Automatic backup failed for %s on %s. except BaseException as msg: print("Version ID Error: %s"%str(msg)) - - - - - - except BaseException as msg: print('%s. [SendToS3Cloud]' % (str(msg))) logging.writeToFile('%s. [SendToS3Cloud]' % (str(msg))) diff --git a/plogical/modSec.py b/plogical/modSec.py index d92e62d06..90ee4eee3 100755 --- a/plogical/modSec.py +++ b/plogical/modSec.py @@ -547,21 +547,36 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/owasp-modsecurity-crs-3.0-mas @staticmethod def disableOWASP(): try: + if ProcessUtilities.decideServer() == ProcessUtilities.OLS: + confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf") + confData = open(confFile).readlines() + conf = open(confFile, 'w') - confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf") - confData = open(confFile).readlines() - conf = open(confFile, 'w') + for items in confData: + if items.find('modsec/owasp') > -1: + continue + else: + conf.writelines(items) - for items in confData: - if items.find('modsec/owasp') > -1: - continue - else: - conf.writelines(items) + conf.close() + installUtilities.reStartLiteSpeed() - conf.close() - installUtilities.reStartLiteSpeed() + print("1,None") + else: + confFile = os.path.join("/usr/local/lsws/conf/modsec.conf") + confData = open(confFile).readlines() + conf = open(confFile, 'w') - print("1,None") + for items in confData: + if items.find('modsec/owasp') > -1: + continue + else: + conf.writelines(items) + + conf.close() + installUtilities.reStartLiteSpeed() + + print("1,None") except BaseException as msg: logging.CyberCPLogFileWriter.writeToFile( diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 34e3839f6..eb30c5290 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1286,42 +1286,48 @@ class WebsiteManager: RemoteBackupConfigobj = RemoteBackupConfig.objects.get(pk=RemoteConfigID) Rconfig = json.loads(RemoteBackupConfigobj.config) - provider = Rconfig['Provider'] - if provider == "Backblaze": - EndURl = Rconfig['EndUrl'] - elif provider == "Amazon": - EndURl = "https://s3.us-east-1.amazonaws.com" - elif provider == "Wasabi": - EndURl = "https://s3.wasabisys.com" - - AccessKey = Rconfig['AccessKey'] - SecertKey = Rconfig['SecertKey'] - - session = boto3.session.Session() - - client = session.client( - 's3', - endpoint_url=EndURl, - aws_access_key_id=AccessKey, - aws_secret_access_key=SecertKey, - verify=False - ) - - ############Creating Bucket - BucketName = randomPassword.generate_pass().lower() try: - client.create_bucket(Bucket=BucketName) - except BaseException as msg: - logging.CyberCPLogFileWriter.writeToFile("Creating Bucket Error: %s" % str(msg)) - data_ret = {'status': 0, 'error_message': str(msg)} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + #This code is only supposed to run if backups are s3, not for SFTP + provider = Rconfig['Provider'] + if provider == "Backblaze": + EndURl = Rconfig['EndUrl'] + elif provider == "Amazon": + EndURl = "https://s3.us-east-1.amazonaws.com" + elif provider == "Wasabi": + EndURl = "https://s3.wasabisys.com" - config = { - 'BackupType': BackupType, - 'BucketName': BucketName - } + AccessKey = Rconfig['AccessKey'] + SecertKey = Rconfig['SecertKey'] + + session = boto3.session.Session() + + client = session.client( + 's3', + endpoint_url=EndURl, + aws_access_key_id=AccessKey, + aws_secret_access_key=SecertKey, + verify=False + ) + + ############Creating Bucket + BucketName = randomPassword.generate_pass().lower() + + try: + client.create_bucket(Bucket=BucketName) + except BaseException as msg: + logging.CyberCPLogFileWriter.writeToFile("Creating Bucket Error: %s" % str(msg)) + data_ret = {'status': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + config = { + 'BackupType': BackupType, + 'BucketName': BucketName + } + except BaseException as msg: + config = {} + pass svobj = RemoteBackupSchedule(RemoteBackupConfig=RemoteBackupConfigobj, Name=ScheduleName, timeintervel=Backfrequency, fileretention=FileRetention, From b86a0ff71aae3a57f95c3a69fe4e9b2abbb24a09 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sun, 1 Jan 2023 11:17:14 +0500 Subject: [PATCH 15/20] initial fix for: https://www.facebook.com/1828741036/videos/679000653934359/ --- plogical/backupUtilities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 1d3128dce..28590baac 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -435,7 +435,8 @@ class backupUtilities: completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf' - copy(completPathToConf, tempStoragePath + '/vhost.conf') + if os.path.exists(completPathToConf): + copy(completPathToConf, tempStoragePath + '/vhost.conf') childDomains = backupMetaData.findall('ChildDomains/domain') @@ -447,7 +448,8 @@ class backupUtilities: completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{actualChildDomain}/vhost.conf' - copy(completPathToConf, f'{tempStoragePath}/{actualChildDomain}.vhost.conf') + if os.path.exists(completPathToConf): + copy(completPathToConf, f'{tempStoragePath}/{actualChildDomain}.vhost.conf') ### Storing SSL for child domainsa From b3551d796e4426d4930d9b4ed72739244496a2ad Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Sun, 1 Jan 2023 11:21:13 +0500 Subject: [PATCH 16/20] further fix for: https://www.facebook.com/1828741036/videos/679000653934359/ --- plogical/backupUtilities.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index 28590baac..99d8f70ce 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -435,8 +435,14 @@ class backupUtilities: completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf' + ### If domain is suspended, this path wont exists, so please check for other + if os.path.exists(completPathToConf): copy(completPathToConf, tempStoragePath + '/vhost.conf') + else: + completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}-suspended/vhost.conf' + if os.path.exists(completPathToConf): + copy(completPathToConf, tempStoragePath + '/vhost.conf') childDomains = backupMetaData.findall('ChildDomains/domain') @@ -450,8 +456,13 @@ class backupUtilities: completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{actualChildDomain}/vhost.conf' if os.path.exists(completPathToConf): copy(completPathToConf, f'{tempStoragePath}/{actualChildDomain}.vhost.conf') + else: + completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{actualChildDomain}-suspended/vhost.conf' + if os.path.exists(completPathToConf): + copy(completPathToConf, f'{tempStoragePath}/{actualChildDomain}.vhost.conf') - ### Storing SSL for child domainsa + + ### Storing SSL for child domainsa sslStoragePath = f'/etc/letsencrypt/live/{actualChildDomain}' From be6a3a8d0f43590b8d446c26ba168fe3969188e1 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Tue, 3 Jan 2023 22:47:47 +0500 Subject: [PATCH 17/20] bug fix: https://www.facebook.com/groups/cyberpanel/posts/2770905259887771/ --- websiteFunctions/website.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index eb30c5290..f08b3081f 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -2804,9 +2804,9 @@ class WebsiteManager: ## Fix https://github.com/usmannasir/cyberpanel/issues/998 - # from plogical.IncScheduler import IncScheduler - isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) - isPU.start() + #from plogical.IncScheduler import IncScheduler + #isPU = IncScheduler('CalculateAndUpdateDiskUsage', {}) + #isPU.start() command = '/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/IncScheduler.py UpdateDiskUsageForce' ProcessUtilities.outputExecutioner(command) From 3d24fff13083740f35efdcb4e595f82bbe9f6bfa Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 16 Jan 2023 19:43:32 +0500 Subject: [PATCH 18/20] ltm --- .../templates/websiteFunctions/CyberpanelPricing.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html index b253b8fd3..d7b5f6c9a 100644 --- a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html +++ b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html @@ -21,7 +21,8 @@

43% of all Websites on the Internet are built with WordPress, so it deserves some love! With CyberPanel WordPress Manager, you can easily Monitor, Analyze, Optimize and - keep your website in Top-Notch performance, all the time.

+ keep your website in Top-Notch performance, all the time. (The lifetime plan does not include a trial; + please see below for subscription-based plans)

@@ -32,6 +33,9 @@ allowfullscreen>

+ + From fec5a0992e59220c37514ebbd770a02b2d5bcf09 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 16 Jan 2023 19:44:49 +0500 Subject: [PATCH 19/20] docs,comminuity --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 37c2d4637..313115f41 100755 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@

CyberPanel Installed

You have successfully installed CyberPanel, please remove this page and upload your website. :)

-

CyberPanel Forums Documentation

+

CyberPanel Forums Documentation

\ No newline at end of file From 29d941824b5fcd4892988b75d9393152a7ab2d7d Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 23 Jan 2023 11:31:20 +0500 Subject: [PATCH 20/20] bug fix: backup schedules --- plogical/IncScheduler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plogical/IncScheduler.py b/plogical/IncScheduler.py index 2b5d5a9c1..b423c0656 100644 --- a/plogical/IncScheduler.py +++ b/plogical/IncScheduler.py @@ -727,8 +727,11 @@ Automatic backup failed for %s on %s. domain, time.strftime("%m.%d.%Y_%H-%M-%S"))).save() jobConfig = json.loads(backupjob.config) - if jobConfig['pid']: - del jobConfig['pid'] + try: + if jobConfig['pid']: + del jobConfig['pid'] + except: + pass jobConfig[IncScheduler.currentStatus] = 'Not running' backupjob.config = json.dumps(jobConfig) backupjob.save()