diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 1e5932b42..83108ec9b 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" %} diff --git a/index.html b/index.html index 37c2d4637..313115f41 100755 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@
\ No newline at end of file diff --git a/install/install.py b/install/install.py index b2c43ab5b..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!") @@ -1988,8 +2013,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/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..b423c0656 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,10 @@ 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": + IncScheduler.CalculateAndUpdateDiskUsage() @staticmethod def startBackup(type): @@ -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() @@ -1352,12 +1355,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))) @@ -1369,6 +1366,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/plogical/backupUtilities.py b/plogical/backupUtilities.py index b61984d07..99d8f70ce 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -435,7 +435,14 @@ class backupUtilities: completPathToConf = f'{backupUtilities.Server_root}/conf/vhosts/{domainName}/vhost.conf' - copy(completPathToConf, tempStoragePath + '/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') @@ -447,9 +454,15 @@ 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') + 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}' @@ -776,6 +789,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 +841,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 +1053,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") 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 != '': diff --git a/plogical/modSec.py b/plogical/modSec.py index e8b499ca1..90ee4eee3 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) @@ -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/plogical/upgrade.py b/plogical/upgrade.py index 9da9b6c0e..d12602281 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2339,9 +2339,9 @@ 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(): 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(): diff --git a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html index 8955cc04b..d7b5f6c9a 100644 --- a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html +++ b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html @@ -8,17 +8,21 @@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.
+ 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)
+ src="{% static 'images/loading.gif' %}"> - SFTP Docs