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 @@

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 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 @@

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.

+ 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)

@@ -29,19 +33,25 @@ allowfullscreen>

+ + - + +
-
+

Features You’ll Love

-
+
@@ -57,7 +67,7 @@
-
+
@@ -75,7 +85,7 @@
-
+
@@ -142,7 +152,6 @@
-
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.
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" %} diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 9edb94b3e..f08b3081f 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, @@ -2796,6 +2802,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)