diff --git a/firewall/firewallManager.py b/firewall/firewallManager.py index 2d6d951de..2e5a14bba 100644 --- a/firewall/firewallManager.py +++ b/firewall/firewallManager.py @@ -1452,7 +1452,7 @@ class FirewallManager: else: return ACLManager.loadErrorJson('installStatus', 0) - execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" execPath = execPath + " installCSF" subprocess.Popen(shlex.split(execPath)) @@ -1520,7 +1520,7 @@ class FirewallManager: else: return ACLManager.loadErrorJson('installStatus', 0) - execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" execPath = execPath + " removeCSF" subprocess.Popen(shlex.split(execPath)) @@ -1579,7 +1579,7 @@ class FirewallManager: controller = data['controller'] status = data['status'] - execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" execPath = execPath + " changeStatus --controller " + controller + " --status " + status output = subprocess.check_output(shlex.split(execPath)) @@ -1613,7 +1613,7 @@ class FirewallManager: protocol = data['protocol'] ports = data['ports'] - execPath = "sudo " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" + execPath = "sudo /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/csf.py" execPath = execPath + " modifyPorts --protocol " + protocol + " --ports " + ports output = subprocess.check_output(shlex.split(execPath)) diff --git a/install/install.py b/install/install.py index db7b271ed..ad18593b7 100644 --- a/install/install.py +++ b/install/install.py @@ -770,7 +770,7 @@ class preFlightsChecks: if subprocess.check_output('systemd-detect-virt').find("openvz") > -1: command = "pip install --upgrade requests" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'Upgrade requests', 1, 0, os.EX_OSERR) except: @@ -780,17 +780,18 @@ class preFlightsChecks: os.chdir(self.path) - #command = "wget http://cyberpanel.net/CyberPanel.1.7.5.tar.gz" - command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + command = "wget http://cyberpanel.sh/CyberPanel.1.7.5.tar.gz" + #command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz" + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'CyberPanel Download', 1, 1, os.EX_OSERR) ## count = 0 - command = "tar zxf CyberPanelTemp.tar.gz" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + command = "tar zxf CyberPanel.1.7.5.tar.gz" + #command = "tar zxf CyberPanelTemp.tar.gz" + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'Extract CyberPanel',1, 1, os.EX_OSERR) ### update password: @@ -852,33 +853,33 @@ class preFlightsChecks: os.chdir("CyberCP") command = "python manage.py makemigrations" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'CyberPanel Make Migrations', 1, 1, os.EX_OSERR) ## command = "python manage.py migrate" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'CyberPanel Migrate',1, 1, os.EX_OSERR) ## Moving static content to lscpd location command = 'mv static /usr/local/lscp/cyberpanel' - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'Move static content', 1, 1, os.EX_OSERR) ## fix permissions command = "chmod -R 744 /usr/local/CyberCP" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'change permissions /usr/local/CyberCP', 1, 0, os.EX_OSERR) ## change owner command = "chown -R cyberpanel:cyberpanel /usr/local/CyberCP" - install.preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', + preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'change owner /usr/local/CyberCP', 1, 0, os.EX_OSERR) @@ -890,7 +891,7 @@ class preFlightsChecks: else: command = 'apt-get -y install unzip' - install.preFlightsChecks.call(command, self.distro, '[install_unzip]', + preFlightsChecks.call(command, self.distro, '[install_unzip]', 'Install unzip', 1, 0, os.EX_OSERR) except BaseException, msg: logging.InstallLog.writeToFile(str(msg) + " [install_unzip]") @@ -903,7 +904,7 @@ class preFlightsChecks: else: command = 'apt-get -y install zip' - install.preFlightsChecks.call(command, self.distro, '[install_zip]', + preFlightsChecks.call(command, self.distro, '[install_zip]', 'Install zip', 1, 0, os.EX_OSERR) except BaseException, msg: logging.InstallLog.writeToFile(str(msg) + " [install_zip]") @@ -913,12 +914,12 @@ class preFlightsChecks: os.chdir("/usr/local/lscp/cyberpanel/") command = 'wget https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-all-languages.zip' - install.preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', 'Download PHPMYAdmin', 1, 0, os.EX_OSERR) ##### command = 'unzip phpMyAdmin-4.8.2-all-languages.zip' - install.preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', 'Unzip PHPMYAdmin', 1, 0, os.EX_OSERR) @@ -927,7 +928,7 @@ class preFlightsChecks: os.remove("phpMyAdmin-4.8.2-all-languages.zip") command = 'mv phpMyAdmin-4.8.2-all-languages phpmyadmin' - install.preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', 'Move PHPMYAdmin', 1, 0, os.EX_OSERR) ## Write secret phrase @@ -2128,80 +2129,43 @@ class preFlightsChecks: try: preFlightsChecks.stdOut("Enabling Firewall!") - count = 0 + if self.distro == ubuntu: + command = 'apt-get -y install firewalld' + else: + command = 'yum -y install firewalld' - while (1): - if self.distro == ubuntu: - command = 'apt-get -y install firewalld' - else: - command = 'yum -y install firewalld' - cmd = shlex.split(command) - res = subprocess.call(cmd) + preFlightsChecks.call(command, self.distro, '[installFirewalld]', + 'Install FirewallD', + 1, 0, os.EX_OSERR) - if preFlightsChecks.resFailed(self.distro, res): - count = count + 1 - preFlightsChecks.stdOut("Unable to install FirewallD, trying again, try number: " + str(count)) - if count == 3: - logging.InstallLog.writeToFile( - "Unable to install FirewallD, funtions related to Firewall will not work! [installFirewalld]") - break - else: - logging.InstallLog.writeToFile("FirewallD successfully installed!") - preFlightsChecks.stdOut("FirewallD successfully installed!") - break ###### if self.distro == centos: # Not available in ubuntu command = 'systemctl restart dbus' - cmd = shlex.split(command) - subprocess.call(cmd) + preFlightsChecks.call(command, self.distro, '[installFirewalld]', + 'Start dbus', + 1, 0, os.EX_OSERR) command = 'systemctl restart systemd-logind' - cmd = shlex.split(command) - subprocess.call(cmd) + preFlightsChecks.call(command, self.distro, '[installFirewalld]', + 'restart logind', + 1, 0, os.EX_OSERR) - count = 0 + command = 'systemctl start firewalld' + preFlightsChecks.call(command, self.distro, '[installFirewalld]', + 'Restart FirewallD', + 1, 0, os.EX_OSERR) - while (1): - command = 'systemctl start firewalld' - cmd = shlex.split(command) - res = subprocess.call(cmd) - - if preFlightsChecks.resFailed(self.distro, res): - count = count + 1 - preFlightsChecks.stdOut("Unable to start FirewallD, trying again, try number: " + str(count)) - if count == 3: - logging.InstallLog.writeToFile( - "Unable to start FirewallD, you can manually start it later using systemctl start firewalld! [installFirewalld]") - break - else: - logging.InstallLog.writeToFile("FirewallD successfully started!") - preFlightsChecks.stdOut("FirewallD successfully started!") - break ########## - count = 0 + command = 'systemctl enable firewalld' + preFlightsChecks.call(command, self.distro, '[installFirewalld]', + 'Install FirewallD', + 1, 0, os.EX_OSERR) - while (1): - command = 'systemctl enable firewalld' - cmd = shlex.split(command) - res = subprocess.call(cmd) - - if preFlightsChecks.resFailed(self.distro, res): - count = count + 1 - preFlightsChecks.stdOut( - "Trying to enable FirewallD at system startup, trying again, try number: " + str(count)) - if count == 3: - logging.InstallLog.writeToFile( - "FirewallD may not start after restart, you need to manually run systemctl enable firewalld ! [installFirewalld]") - break - else: - logging.InstallLog.writeToFile("FirewallD successfully enabled on system startup!") - preFlightsChecks.stdOut("FirewallD successfully enabled on system startup!") - break FirewallUtilities.addRule("tcp", "8090") FirewallUtilities.addRule("tcp", "80") diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index c7b89bffb..c01c8b380 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -609,6 +609,8 @@ class InstallCyberPanel: if self.distro == ubuntu: command = "DEBIAN_FRONTEND=noninteractive apt-get -y install pdns-server pdns-backend-mysql" + os.system(command) + return 1 else: command = 'yum -y install pdns pdns-backend-mysql' diff --git a/plogical/csf.py b/plogical/csf.py index 514c15b52..703886722 100644 --- a/plogical/csf.py +++ b/plogical/csf.py @@ -175,7 +175,7 @@ class CSF(multi.Thread): return currentSettings except BaseException, msg: - logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[fetchCSFSettings]") + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [fetchCSFSettings]") @staticmethod def changeStatus(controller, status): diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index 9c9fa0844..23565a3fc 100644 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -21,6 +21,7 @@ class mysqlUtilities: f = open(passFile) data = f.read() password = data.split('\n', 1)[0] + password = password.strip('\n').strip('\r') conn = mysql.connect(user='root', passwd=password) cursor = conn.cursor() diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 232fe8a29..6e1412d2e 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -13,6 +13,7 @@ import json import time from baseTemplate.models import version import MySQLdb as mysql +from CyberCP import settings class Upgrade: logPath = "/usr/local/lscp/logs/upgradeLog" @@ -217,7 +218,15 @@ WantedBy=multi-user.target""" try: conn = mysql.connect(db=db, user='root', passwd=password) except: - conn = mysql.connect(host = '127.0.0.1', port = 3307 , db=db, user='root', passwd=password) + try: + conn = mysql.connect(host = '127.0.0.1', port = 3307 , db=db, user='root', passwd=password) + except: + dbUser = settings.DATABASES['default']['USER'] + password = settings.DATABASES['default']['PASSWORD'] + host = settings.DATABASES['default']['HOST'] + port = settings.DATABASES['default']['PORT'] + + conn = mysql.connect(host=host, port=port, db=db, user=dbUser, passwd=password) cursor = conn.cursor() return conn, cursor @@ -291,7 +300,10 @@ WantedBy=multi-user.target""" except: pass - connection.close() + try: + connection.close() + except: + pass except OSError, msg: Upgrade.stdOut(str(msg) + " [applyLoginSystemMigrations]") @@ -352,7 +364,10 @@ WantedBy=multi-user.target""" except: pass - connection.close() + try: + connection.close() + except: + pass except OSError, msg: Upgrade.stdOut(str(msg) + " [applyLoginSystemMigrations]") @@ -414,7 +429,10 @@ WantedBy=multi-user.target""" except: pass - connection.close() + try: + connection.close() + except: + pass except: pass @@ -523,7 +541,10 @@ WantedBy=multi-user.target""" except: pass - connection.close() + try: + connection.close() + except: + pass except: pass @@ -726,6 +747,21 @@ WantedBy=multi-user.target""" except BaseException, msg: Upgrade.stdOut(str(msg) + " [installLSCPD]") + @staticmethod + def installPHP73(): + try: + command = 'yum install -y lsphp73 lsphp73-json lsphp73-xmlrpc lsphp73-xml lsphp73-tidy lsphp73-soap lsphp73-snmp ' \ + 'lsphp73-recode lsphp73-pspell lsphp73-process lsphp73-pgsql lsphp73-pear lsphp73-pdo lsphp73-opcache ' \ + 'lsphp73-odbc lsphp73-mysqlnd lsphp73-mcrypt lsphp73-mbstring lsphp73-ldap lsphp73-intl lsphp73-imap ' \ + 'lsphp73-gmp lsphp73-gd lsphp73-enchant lsphp73-dba lsphp73-common lsphp73-bcmath' + Upgrade.executioner(command, 'Install PHP 73, 0') + except: + command = 'DEBIAN_FRONTEND=noninteractive apt-get -y install ' \ + 'lsphp7? lsphp7?-common lsphp7?-curl lsphp7?-dev lsphp7?-imap lsphp7?-intl lsphp7?-json ' \ + 'lsphp7?-ldap lsphp7?-mysql lsphp7?-opcache lsphp7?-pspell lsphp7?-recode ' \ + 'lsphp7?-sqlite3 lsphp7?-tidy' + Upgrade.executioner(command, 'Install PHP 73, 0') + @staticmethod def upgrade(): @@ -778,6 +814,7 @@ WantedBy=multi-user.target""" Upgrade.s3BackupMigrations() Upgrade.enableServices() + Upgrade.installPHP73() Upgrade.setupCLI() Upgrade.installLSCPD() Upgrade.fixPermissions() diff --git a/plogical/vhost.py b/plogical/vhost.py index 5b9bcd5c7..a5a53b4c1 100644 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -681,7 +681,6 @@ class vhost: @staticmethod def changePHP(vhFile, phpVersion): if ProcessUtilities.decideServer() == ProcessUtilities.OLS: - finalphp = 0 try: data = open(vhFile, "r").readlines() @@ -689,7 +688,7 @@ class vhost: writeDataToFile = open(vhFile, "w") - path = " path /usr/local/lsws/lsphp" + str(finalphp) + "/bin/lsphp\n" + path = " path /usr/local/lsws/lsphp" + str(php) + "/bin/lsphp\n" for items in data: if items.find("/usr/local/lsws/lsphp") > -1 and items.find("path") > -1: @@ -711,8 +710,6 @@ class vhost: else: try: data = open(vhFile, "r").readlines() - if phpVersion == "PHP 5.3": - finalphp = 53 php = PHPManager.getPHPString(phpVersion) @@ -760,7 +757,6 @@ class vhost: logging.CyberCPLogFileWriter.writeToFile( str(msg) + " [IO Error with per host config file [checkIfRewriteEnabled]]") return 0 - return 1 @staticmethod def findDomainBW(domainName, totalAllowed): diff --git a/serverStatus/litespeed/httpd_config.xml b/serverStatus/litespeed/httpd_config.xml index de85c980b..6c970cb8f 100644 --- a/serverStatus/litespeed/httpd_config.xml +++ b/serverStatus/litespeed/httpd_config.xml @@ -320,6 +320,26 @@ SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+ 2047M 400 500 + + + lsapi + lsphp73 +
uds://tmp/lshttpd/lsphp73.sock
+ 35 + PHP_LSAPI_CHILDREN=35 + 60 + 0 + 1 + 0 + 3 + $SERVER_ROOT/lsphp73/bin/lsphp + 100 + 1 + 0 + 2047M + 2047M + 400 + 500
@@ -367,6 +387,11 @@ SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+ php72 lsapi lsphp72 + + + php73 + lsapi + lsphp73 diff --git a/tuning/templates/tuning/phpTuning.html b/tuning/templates/tuning/phpTuning.html index eda3d6f5d..ce3ae2482 100644 --- a/tuning/templates/tuning/phpTuning.html +++ b/tuning/templates/tuning/phpTuning.html @@ -173,6 +173,7 @@ + diff --git a/tuning/views.py b/tuning/views.py index 01c7ed72b..215047ba3 100644 --- a/tuning/views.py +++ b/tuning/views.py @@ -1,16 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.shortcuts import render,redirect -from django.http import HttpResponse +from django.shortcuts import redirect import json -import plogical.CyberCPLogFileWriter as logging -from plogical.tuning import tuning from loginSystem.views import loadLoginPage -from plogical.virtualHostUtilities import virtualHostUtilities -import subprocess -import shlex -from plogical.acl import ACLManager from tuning import tuningManager # Create your views here.