diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 2d40f8993..c2fb959b1 100755 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -72,7 +72,7 @@ class secMiddleware: final_json = json.dumps(final_dic) return HttpResponse(final_json) - if request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('filemanager') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1: + if request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1: continue if key == 'recordContentAAAA' or key == 'backupDestinations' or key == 'ports' \ or key == 'imageByPass' or key == 'passwordByPass' or key == 'cronCommand' \ diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index 8164d30a6..6023978e9 100755 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -10,10 +10,11 @@ import install from os.path import exists import time -#distros -centos=0 -ubuntu=1 -cent8=2 +# distros +centos = 0 +ubuntu = 1 +cent8 = 2 + def get_Ubuntu_release(): release = -1 @@ -34,12 +35,13 @@ def get_Ubuntu_release(): return release -class InstallCyberPanel: +class InstallCyberPanel: mysql_Root_password = "" mysqlPassword = "" - def __init__(self, rootPath, cwd, distro, ent, serial = None, port = None, ftp = None, dns = None, publicip = None, remotemysql = None , mysqlhost = None, mysqldb = None, mysqluser = None, mysqlpassword = None, mysqlport = None): + def __init__(self, rootPath, cwd, distro, ent, serial=None, port=None, ftp=None, dns=None, publicip=None, + remotemysql=None, mysqlhost=None, mysqldb=None, mysqluser=None, mysqlpassword=None, mysqlport=None): self.server_root_path = rootPath self.cwd = cwd self.distro = distro @@ -133,7 +135,7 @@ class InstallCyberPanel: return 1 def reStartLiteSpeed(self): - command = self.server_root_path+"bin/lswsctrl restart" + command = self.server_root_path + "bin/lswsctrl restart" install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) def fix_ols_configs(self): @@ -143,7 +145,7 @@ class InstallCyberPanel: ## remove example virtual host - data = open(self.server_root_path+"conf/httpd_config.conf",'r').readlines() + data = open(self.server_root_path + "conf/httpd_config.conf", 'r').readlines() writeDataToFile = open(self.server_root_path + "conf/httpd_config.conf", 'w') @@ -166,13 +168,13 @@ class InstallCyberPanel: try: InstallCyberPanel.stdOut("Changing default port to 80..", 1) - data = open(self.server_root_path+"conf/httpd_config.conf").readlines() + data = open(self.server_root_path + "conf/httpd_config.conf").readlines() - writeDataToFile = open(self.server_root_path+"conf/httpd_config.conf", 'w') + writeDataToFile = open(self.server_root_path + "conf/httpd_config.conf", 'w') for items in data: if (items.find("*:8088") > -1): - writeDataToFile.writelines(items.replace("*:8088","*:80")) + writeDataToFile.writelines(items.replace("*:8088", "*:80")) else: writeDataToFile.writelines(items) @@ -208,7 +210,6 @@ class InstallCyberPanel: ## only php 71 if self.distro == centos: - command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-soap lsphp71-snmp ' \ 'lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache ' \ 'lsphp71-odbc lsphp71-mysqlnd lsphp71-mcrypt lsphp71-mbstring lsphp71-ldap lsphp71-intl lsphp71-imap ' \ @@ -223,7 +224,6 @@ class InstallCyberPanel: install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - ## only php 73 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 ' \ @@ -277,13 +277,14 @@ class InstallCyberPanel: self.startMariaDB() - def changeMYSQLRootPassword(self): if self.remotemysql == 'OFF': if self.distro == ubuntu: - passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';UPDATE user SET plugin='' WHERE User='root';flush privileges;" % (InstallCyberPanel.mysql_Root_password) + passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';UPDATE user SET plugin='' WHERE User='root';flush privileges;" % ( + InstallCyberPanel.mysql_Root_password) else: - passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';flush privileges;" % (InstallCyberPanel.mysql_Root_password) + passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';flush privileges;" % ( + InstallCyberPanel.mysql_Root_password) command = 'mysql -u root -e "' + passwordCMD + '"' @@ -367,7 +368,6 @@ class InstallCyberPanel: command = 'dnf install pure-ftpd -y' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - ####### Install pureftpd to system startup command = "systemctl enable " + install.preFlightsChecks.pureFTPDServiceName(self.distro) @@ -380,7 +380,7 @@ class InstallCyberPanel: command = 'useradd -u 2001 -s /bin/false -d /bin/null -c "pureftpd user" -g ftpgroup ftpuser' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) - + def startPureFTPD(self): ############## Start pureftpd ###################### if self.distro == ubuntu: @@ -400,7 +400,8 @@ class InstallCyberPanel: except: logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL") - if (self.distro == centos or self.distro == cent8) or (self.distro == ubuntu and get_Ubuntu_release() == 18.14): + if (self.distro == centos or self.distro == cent8) or ( + self.distro == ubuntu and get_Ubuntu_release() == 18.14): command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' else: command = 'openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' @@ -418,7 +419,7 @@ class InstallCyberPanel: shutil.copytree("pure-ftpd-one", ftpdPath) else: if mysql == 'Two': - shutil.copytree("pure-ftpd",ftpdPath) + shutil.copytree("pure-ftpd", ftpdPath) else: shutil.copytree("pure-ftpd-one", ftpdPath) @@ -430,18 +431,17 @@ class InstallCyberPanel: except OSError as err: self.stdOut("[ERROR] Error creating extra pure-ftpd directories: " + str(err), ". Should be ok", 1) - data = open(ftpdPath+"/pureftpd-mysql.conf","r").readlines() + data = open(ftpdPath + "/pureftpd-mysql.conf", "r").readlines() - writeDataToFile = open(ftpdPath+"/pureftpd-mysql.conf","w") + writeDataToFile = open(ftpdPath + "/pureftpd-mysql.conf", "w") - dataWritten = "MYSQLPassword "+InstallCyberPanel.mysqlPassword+'\n' + dataWritten = "MYSQLPassword " + InstallCyberPanel.mysqlPassword + '\n' for items in data: - if items.find("MYSQLPassword")>-1: + if items.find("MYSQLPassword") > -1: writeDataToFile.writelines(dataWritten) else: writeDataToFile.writelines(items) - writeDataToFile.close() ftpConfPath = '/etc/pure-ftpd/pureftpd-mysql.conf' @@ -460,7 +460,7 @@ class InstallCyberPanel: if os.path.exists('/etc/pure-ftpd/db/mysql.conf'): os.remove('/etc/pure-ftpd/db/mysql.conf') - shutil.copy(ftpdPath+"/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf') + shutil.copy(ftpdPath + "/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf') else: shutil.copy(ftpdPath + "/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf') @@ -479,7 +479,6 @@ class InstallCyberPanel: command = 'echo "/etc/pure-ftpd/db/mysql.conf" > /etc/pure-ftpd/conf/MySQLConfigFile' subprocess.call(command, shell=True) - command = 'ln -s /etc/pure-ftpd/conf/MySQLConfigFile /etc/pure-ftpd/auth/30mysql' install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) @@ -504,7 +503,6 @@ class InstallCyberPanel: command = 'systemctl disable systemd-resolved.service' install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) - try: os.rename('/etc/resolv.conf', 'etc/resolved.conf') except OSError as e: @@ -514,10 +512,9 @@ class InstallCyberPanel: try: os.remove('/etc/resolv.conf') except OSError as e1: - InstallCyberPanel.stdOut("[ERROR] Unable to remove existing /etc/resolv.conf to install PowerDNS: " + - str(e1), 1, 1, os.EX_OSERR) - - + InstallCyberPanel.stdOut( + "[ERROR] Unable to remove existing /etc/resolv.conf to install PowerDNS: " + + str(e1), 1, 1, os.EX_OSERR) # try: # f = open('/etc/resolv.conf', 'a') @@ -582,12 +579,11 @@ class InstallCyberPanel: else: writeDataToFile.writelines(items) - #if self.distro == ubuntu: + # if self.distro == ubuntu: # os.fchmod(writeDataToFile.fileno(), stat.S_IRUSR | stat.S_IWUSR) writeDataToFile.close() - if self.remotemysql == 'ON': command = "sed -i 's|gmysql-host=localhost|gmysql-host=%s|g' %s" % (self.mysqlhost, dnsPath) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) @@ -613,8 +609,8 @@ class InstallCyberPanel: install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) -def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns = None, publicip = None, remotemysql = None , mysqlhost = None, mysqldb = None, mysqluser = None, mysqlpassword = None, mysqlport = None): - +def Main(cwd, mysql, distro, ent, serial=None, port="8090", ftp=None, dns=None, publicip=None, remotemysql=None, + mysqlhost=None, mysqldb=None, mysqluser=None, mysqlpassword=None, mysqlport=None): InstallCyberPanel.mysqlPassword = randomPassword.generate_pass() InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass() @@ -630,7 +626,8 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns password.writelines(InstallCyberPanel.mysql_Root_password) password.close() else: - mysqlData = {'remotemysql': remotemysql, 'mysqlhost': mysqlhost, 'mysqldb':mysqldb, 'mysqluser': mysqluser, 'mysqlpassword': mysqlpassword, 'mysqlport': mysqlport} + mysqlData = {'remotemysql': remotemysql, 'mysqlhost': mysqlhost, 'mysqldb': mysqldb, 'mysqluser': mysqluser, + 'mysqlpassword': mysqlpassword, 'mysqlport': mysqlport} from json import dumps writeToFile = open(file_name, 'w') writeToFile.write(dumps(mysqlData)) @@ -640,8 +637,6 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns print(open(file_name, 'r').read()) time.sleep(10) - - try: command = 'chmod 640 %s' % (file_name) install.preFlightsChecks.call(command, distro, '[chmod]', @@ -659,7 +654,8 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns else: InstallCyberPanel.mysqlPassword = InstallCyberPanel.mysql_Root_password - installer = InstallCyberPanel("/usr/local/lsws/",cwd, distro, ent, serial, port, ftp, dns, publicip, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport) + installer = InstallCyberPanel("/usr/local/lsws/", cwd, distro, ent, serial, port, ftp, dns, publicip, remotemysql, + mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport) logging.InstallLog.writeToFile('Installing LiteSpeed Web server,40') installer.installLiteSpeed() @@ -680,7 +676,7 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns if distro == ubuntu: installer.fixMariaDB() - mysqlUtilities.createDatabase("cyberpanel","cyberpanel", InstallCyberPanel.mysqlPassword, publicip) + mysqlUtilities.createDatabase("cyberpanel", "cyberpanel", InstallCyberPanel.mysqlPassword, publicip) if ftp == None: installer.installPureFTPD() @@ -700,4 +696,4 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns if dns == 'ON': installer.installPowerDNS() installer.installPowerDNSConfigurations(InstallCyberPanel.mysqlPassword, mysql) - installer.startPowerDNS() + installer.startPowerDNS() \ No newline at end of file diff --git a/managePHP/php72.xml b/managePHP/php72.xml index fd5bee175..7967b49cc 100755 --- a/managePHP/php72.xml +++ b/managePHP/php72.xml @@ -272,4 +272,10 @@ 0 + + lsphp72-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/php73.xml b/managePHP/php73.xml index a2f4d3fbf..c2383820a 100755 --- a/managePHP/php73.xml +++ b/managePHP/php73.xml @@ -272,4 +272,10 @@ 0 + + lsphp73-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/php74.xml b/managePHP/php74.xml index 63f5727e5..c062a1a33 100755 --- a/managePHP/php74.xml +++ b/managePHP/php74.xml @@ -272,4 +272,10 @@ 0 + + lsphp74-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/php80.xml b/managePHP/php80.xml index c95d94cee..3f35d5e91 100755 --- a/managePHP/php80.xml +++ b/managePHP/php80.xml @@ -272,4 +272,10 @@ 0 + + lsphp80-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/ubuntuphp72.xml b/managePHP/ubuntuphp72.xml index 9914be67a..ed5c33720 100755 --- a/managePHP/ubuntuphp72.xml +++ b/managePHP/ubuntuphp72.xml @@ -122,4 +122,10 @@ 0 + + lsphp72-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/ubuntuphp73.xml b/managePHP/ubuntuphp73.xml index 175b09399..915ac3755 100755 --- a/managePHP/ubuntuphp73.xml +++ b/managePHP/ubuntuphp73.xml @@ -122,4 +122,10 @@ 0 + + lsphp73-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/ubuntuphp74.xml b/managePHP/ubuntuphp74.xml index f60add02a..3652133d7 100755 --- a/managePHP/ubuntuphp74.xml +++ b/managePHP/ubuntuphp74.xml @@ -122,4 +122,10 @@ 0 + + lsphp74-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + + diff --git a/managePHP/ubuntuphp80.xml b/managePHP/ubuntuphp80.xml index 61ef9d667..8a1d7ca0e 100755 --- a/managePHP/ubuntuphp80.xml +++ b/managePHP/ubuntuphp80.xml @@ -122,4 +122,10 @@ 0 + + lsphp80-sodium + The php-sodium extension provides strong encryption capabilities in an easy and consistent way. + 0 + +