diff --git a/cli/cyberPanel.py b/cli/cyberPanel.py index 939f0b7e5..f17755e51 100755 --- a/cli/cyberPanel.py +++ b/cli/cyberPanel.py @@ -1,7 +1,9 @@ #!/usr/local/CyberCP/bin/python -import os,sys +import os, sys + sys.path.append('/usr/local/CyberCP') import django + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings") django.setup() from inspect import stack @@ -27,12 +29,19 @@ from plogical.backupSchedule import backupSchedule # All that we see or seem is but a dream within a dream. +def get_cyberpanel_version(): + with open('/usr/local/CyberCP/version.txt') as version: + version_file = version.read() + version = json.loads(str(version_file)) + return f"{version['version']}.{version['build']}" + + class cyberPanel: def printStatus(self, operationStatus, errorMessage): data = json.dumps({'success': operationStatus, 'errorMessage': errorMessage - }) + }) print(data) ## Website Functions @@ -42,10 +51,10 @@ class cyberPanel: from random import randint externalApp = "".join(re.findall("[a-zA-Z]+", domainName))[:5] + str(randint(1000, 9999)) phpSelection = 'PHP ' + php - + try: counter = 0 - _externalApp=externalApp + _externalApp = externalApp while True: tWeb = Websites.objects.get(externalApp=externalApp) externalApp = '%s%s' % (_externalApp, str(counter)) @@ -55,10 +64,10 @@ class cyberPanel: time.sleep(2) result = virtualHostUtilities.createVirtualHost(domainName, email, phpSelection, externalApp, ssl, dkim, - openBasedir, owner, package, 0) + openBasedir, owner, package, 0) if result[0] == 1: - self.printStatus(1,'None') + self.printStatus(1, 'None') else: self.printStatus(0, result[1]) @@ -72,10 +81,11 @@ class cyberPanel: path = '/home/' + masterDomain + '/public_html/' + domainName phpSelection = 'PHP ' + php - result = virtualHostUtilities.createDomain(masterDomain, domainName, phpSelection, path, ssl, dkim, openBasedir, owner, 0) + result = virtualHostUtilities.createDomain(masterDomain, domainName, phpSelection, path, ssl, dkim, + openBasedir, owner, 0) if result[0] == 1: - self.printStatus(1,'None') + self.printStatus(1, 'None') else: self.printStatus(0, result[1]) @@ -98,7 +108,7 @@ class cyberPanel: result = virtualHostUtilities.deleteDomain(childDomain) if result[0] == 1: - self.printStatus(1,'None') + self.printStatus(1, 'None') else: self.printStatus(0, result[1]) @@ -123,13 +133,14 @@ class cyberPanel: state = "Suspended" else: state = "Active" - dic = {'domain': items.domain, 'adminEmail': items.adminEmail,'ipAddress':ipAddress,'admin': items.admin.userName,'package': items.package.packageName,'state':state} + dic = {'domain': items.domain, 'adminEmail': items.adminEmail, 'ipAddress': ipAddress, + 'admin': items.admin.userName, 'package': items.package.packageName, 'state': state} if checker == 0: json_data = json_data + json.dumps(dic) checker = 1 else: - json_data = json_data +',' + json.dumps(dic) + json_data = json_data + ',' + json.dumps(dic) json_data = json_data + ']' final_json = json.dumps(json_data) @@ -149,14 +160,16 @@ class cyberPanel: ipData = f.read() ipAddress = ipData.split('\n', 1)[0] - table = PrettyTable(['ID','Domain', 'IP Address', 'Package', 'Owner', 'State', 'Email']) + table = PrettyTable(['ID', 'Domain', 'IP Address', 'Package', 'Owner', 'State', 'Email']) for items in websites: if items.state == 0: state = "Suspended" else: state = "Active" - table.add_row([items.id, items.domain, ipAddress, items.package.packageName, items.admin.userName, state, items.adminEmail]) + table.add_row( + [items.id, items.domain, ipAddress, items.package.packageName, items.admin.userName, state, + items.adminEmail]) print(table) except BaseException as msg: @@ -174,7 +187,7 @@ class cyberPanel: result = vhost.changePHP(completePathToConfigFile, phpVersion) if result[0] == 1: - self.printStatus(1,'None') + self.printStatus(1, 'None') else: self.printStatus(0, result[1]) @@ -338,7 +351,7 @@ class cyberPanel: # Setup default backup path to /home//backup if not passed in if backupPath is None: backupPath = '/home/' + virtualHostName + '/backup' - + # remove trailing slash in path backupPath = backupPath.rstrip("/") backuptime = time.strftime("%m.%d.%Y_%H-%M-%S") @@ -387,7 +400,8 @@ class cyberPanel: ## Packages - def createPackage(self, owner, packageName, diskSpace, bandwidth, emailAccounts, dataBases, ftpAccounts, allowedDomains): + def createPackage(self, owner, packageName, diskSpace, bandwidth, emailAccounts, dataBases, ftpAccounts, + allowedDomains): try: admin = Administrator.objects.get(userName=owner) @@ -431,7 +445,7 @@ class cyberPanel: 'bandwidth': items.bandwidth, 'ftpAccounts ': items.ftpAccounts, 'dataBases': items.dataBases, - 'emailAccounts':items.emailAccounts + 'emailAccounts': items.emailAccounts } if checker == 0: @@ -454,10 +468,13 @@ class cyberPanel: records = Package.objects.all() - table = PrettyTable(['Name', 'Domains', 'Disk Space', 'Bandwidth', 'FTP Accounts', 'Databases', 'Email Accounts']) + table = PrettyTable( + ['Name', 'Domains', 'Disk Space', 'Bandwidth', 'FTP Accounts', 'Databases', 'Email Accounts']) for items in records: - table.add_row([items.packageName, items.allowedDomains, items.diskSpace, items.bandwidth, items.ftpAccounts, items.dataBases, items.emailAccounts]) + table.add_row( + [items.packageName, items.allowedDomains, items.diskSpace, items.bandwidth, items.ftpAccounts, + items.dataBases, items.emailAccounts]) print(table) except BaseException as msg: @@ -584,8 +601,8 @@ class cyberPanel: for items in records: dic = { - 'email': items.email, - } + 'email': items.email, + } if checker == 0: json_data = json_data + json.dumps(dic) @@ -857,7 +874,8 @@ def main(): else: openBasedir = 0 - cyberpanel.createWebsite(args.package, args.owner, args.domainName, args.email, args.php, ssl, dkim, openBasedir) + cyberpanel.createWebsite(args.package, args.owner, args.domainName, args.email, args.php, ssl, dkim, + openBasedir) elif args.function == "deleteWebsite": completeCommandExample = 'cyberpanel deleteWebsite --domainName cyberpanel.net' @@ -1086,8 +1104,6 @@ def main(): print("\n\nPlease enter value for Allowed Child Domains. For example:\n\n" + completeCommandExample + "\n\n") return - - cyberpanel.createPackage(args.owner, args.packageName, args.diskSpace, args.bandwidth, args.emailAccounts, args.dataBases, args.ftpAccounts, args.allowedDomains) elif args.function == "deletePackage": @@ -1334,14 +1350,7 @@ def main(): ProcessUtilities.executioner(command) elif args.function == 'version' or args.function == 'v' or args.function == 'V': ## Get CurrentVersion - with open('/usr/local/CyberCP/version.txt') as file: - file_contents = file.read() - version = re.search('\d.\d', file_contents) - version = version.group() - build = file_contents[-2:] - build = build[0:1] - currentversion = version + '.' + build - print (currentversion) + print(get_cyberpanel_version()) ### User Functions @@ -1574,6 +1583,5 @@ def main(): wm.installJoomla(1, data) - if __name__ == "__main__": main() diff --git a/install/litespeed/httpd_config.xml b/install/litespeed/httpd_config.xml index 026bf6572..d9e8c24a9 100755 --- a/install/litespeed/httpd_config.xml +++ b/install/litespeed/httpd_config.xml @@ -351,6 +351,26 @@ SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+ 400 500 + + lsapi + lsphp80 +
uds://tmp/lshttpd/lsphp80.sock
+ 35 + PHP_LSAPI_CHILDREN=35 + 60 + 0 + 1 + 0 + 3 + $SERVER_ROOT/lsphp80/bin/lsphp + 100 + 1 + 0 + 2047M + 2047M + 400 + 500 +
@@ -408,6 +428,11 @@ SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+ lsapi lsphp74 + + php80 + lsapi + lsphp80 + diff --git a/install/php-configs/php.ini b/install/php-configs/php.ini index 99712a192..984c0cbfb 100755 --- a/install/php-configs/php.ini +++ b/install/php-configs/php.ini @@ -393,7 +393,7 @@ max_input_time = 60 ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit -memory_limit = 128M +memory_limit = 256M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; @@ -660,7 +660,7 @@ auto_globals_jit = On ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. ; http://php.net/post-max-size -post_max_size = 8M +post_max_size = 20M ; Automatically add files before PHP document. ; http://php.net/auto-prepend-file @@ -808,7 +808,7 @@ file_uploads = On ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize -upload_max_filesize = 2M +upload_max_filesize = 20M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 diff --git a/install/phpconfigs/php71.conf b/install/phpconfigs/php71.conf index 446d3b4b9..618143265 100755 --- a/install/phpconfigs/php71.conf +++ b/install/phpconfigs/php71.conf @@ -1,4 +1,4 @@ -extprocessor php71 { +php71.confextprocessor php71 { type lsapi address uds://tmp/lshttpd/lsphp71.sock maxConns 50 diff --git a/install/phpconfigs/php72.conf b/install/phpconfigs/php72.conf new file mode 100755 index 000000000..9a4a8c586 --- /dev/null +++ b/install/phpconfigs/php72.conf @@ -0,0 +1,16 @@ +php72.confextprocessor php72 { + type lsapi + address uds://tmp/lshttpd/lsphp72.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp72/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} + diff --git a/install/phpconfigs/php73.conf b/install/phpconfigs/php73.conf new file mode 100755 index 000000000..2017f879f --- /dev/null +++ b/install/phpconfigs/php73.conf @@ -0,0 +1,16 @@ +php73.confextprocessor php73 { + type lsapi + address uds://tmp/lshttpd/lsphp73.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp73/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} + diff --git a/install/phpconfigs/php74.conf b/install/phpconfigs/php74.conf new file mode 100755 index 000000000..407e1c4b5 --- /dev/null +++ b/install/phpconfigs/php74.conf @@ -0,0 +1,16 @@ +php80.confextprocessor php80 { + type lsapi + address uds://tmp/lshttpd/lsphp80.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp80/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} + diff --git a/install/phpconfigs/php80.conf b/install/phpconfigs/php80.conf new file mode 100755 index 000000000..d60ccd0d7 --- /dev/null +++ b/install/phpconfigs/php80.conf @@ -0,0 +1,16 @@ +php74.confextprocessor php74 { + type lsapi + address uds://tmp/lshttpd/lsphp74.sock + maxConns 50 + initTimeout 60 + retryTimeout 0 + persistConn 1 + respBuffer 0 + autoStart 1 + path /usr/local/lsws/lsphp74/bin/lsphp + memSoftLimit 2047M + memHardLimit 2047M + procSoftLimit 400 + procHardLimit 500 +} +