diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index 7241f8749..691453f16 100755 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -127,7 +127,6 @@ def installMautic(self): FNULL = open(os.devnull, 'w') - finalPath = '' self.permPath = '' @@ -207,9 +206,6 @@ def installMautic(self): statusFile.writelines('Downloading Mautic Core,30') statusFile.close() - #command = "wget https://github.com/mautic/mautic/releases/download/%s/%s.zip" % ( - #ApplicationInstaller.MauticVersion, ApplicationInstaller.MauticVersion) - ### replace command with composer install command = f'{phpPath} /usr/bin/composer create-project mautic/recommended-project:^4 {finalPath}' ProcessUtilities.outputExecutioner(command, externalApp, None) @@ -218,9 +214,6 @@ def installMautic(self): statusFile.writelines('Extracting Mautic Core,50') statusFile.close() - ### replace command with composer install - #command = "unzip %s.zip" % (ApplicationInstaller.MauticVersion) - #ProcessUtilities.outputExecutioner(command, externalApp, None, finalPath) ## @@ -235,49 +228,6 @@ def installMautic(self): finalURL = domainName -# ACLManager.CreateSecureDir() -# localDB = '%s/%s' % ('/usr/local/CyberCP/tmp', str(randint(1000, 9999))) -# -# localDBContent = """ 'localhost', -# 'db_table_prefix' => null, -# 'db_port' => 3306, -# 'db_name' => '%s', -# 'db_user' => '%s', -# 'db_password' => '%s', -# 'db_backup_tables' => true, -# 'db_backup_prefix' => 'bak_', -# 'admin_email' => '%s', -# 'admin_password' => '%s', -# 'mailer_transport' => null, -# 'mailer_host' => null, -# 'mailer_port' => null, -# 'mailer_user' => null, -# 'mailer_password' => null, -# 'mailer_api_key' => null, -# 'mailer_encryption' => null, -# 'mailer_auth_mode' => null, -# );""" % (dbName, dbUser, dbPassword, email, password) -# -# writeToFile = open(localDB, 'w') -# writeToFile.write(localDBContent) -# writeToFile.close() - - #command = 'rm -rf %s/app/config/local.php' % (finalPath) - #ProcessUtilities.executioner(command, externalApp) - - #command = 'chown %s:%s %s' % (externalApp, externalApp, localDB) - #ProcessUtilities.executioner(command) - - #command = 'cp %s %s/app/config/local.php' % (localDB, finalPath) - #ProcessUtilities.executioner(command, externalApp) - - ### replace install command with comspoer soo - #command = f"{phpPath} bin/console mautic:install http://%s -f" % (finalURL) - command = f"{phpPath} bin/console mautic:install --db_host='localhost' --db_name='{dbName}' --db_user='{dbUser}' --db_password='{dbPassword}' --admin_username='{username}' --admin_email='{email}' --admin_password='{password}' --db_port='3306' http://{finalURL} -f" result = ProcessUtilities.outputExecutioner(command, externalApp, None, finalPath) diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 0e4b895eb..f3a6df948 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -1402,6 +1402,10 @@ def checkIfMailServerSSLIssued(self): for items in postFixLines: if items.find('myhostname') > -1 and items[0] != '#': self.mailHostName = items.split('=')[1].strip(' ') + + if os.path.exists(ProcessUtilities.debugPath): + logging.CyberCPLogFileWriter.writeToFile(f'Mail server SSL is issued with value: {self.mailHostName}') + self.MailSSL = 1 except BaseException as msg: self.MailSSL = 0 diff --git a/plogical/upgrade.py b/plogical/upgrade.py index d265417de..05376d97e 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2145,85 +2145,87 @@ def downloadAndUpgrade(versionNumbring, branch): def installLSCPD(branch): try: - Upgrade.stdOut("Starting LSCPD installation..") + if branch.find('SoftUpgrade') == -1: - cwd = os.getcwd() + Upgrade.stdOut("Starting LSCPD installation..") - os.chdir('/usr/local') + cwd = os.getcwd() - command = 'yum -y install gcc gcc-c++ make autoconf glibc rcs' - Upgrade.executioner(command, 'LSCPD Pre-reqs [one]', 0) + os.chdir('/usr/local') - ## + command = 'yum -y install gcc gcc-c++ make autoconf glibc rcs' + Upgrade.executioner(command, 'LSCPD Pre-reqs [one]', 0) - lscpdPath = '/usr/local/lscp/bin/lscpd' + ## - if os.path.exists(lscpdPath): - os.remove(lscpdPath) + lscpdPath = '/usr/local/lscp/bin/lscpd' + if os.path.exists(lscpdPath): + os.remove(lscpdPath) - try: - result = subprocess.run('uname -a', capture_output=True, text=True, shell=True) - if result.stdout.find('aarch64') == -1: + try: + result = subprocess.run('uname -a', capture_output=True, text=True, shell=True) + + if result.stdout.find('aarch64') == -1: + lscpdSelection = 'lscpd-0.3.1' + if os.path.exists(Upgrade.UbuntuPath): + result = open(Upgrade.UbuntuPath, 'r').read() + if result.find('22.04') > -1: + lscpdSelection = 'lscpd.0.4.0' + else: + lscpdSelection = 'lscpd.aarch64' + + except: + lscpdSelection = 'lscpd-0.3.1' if os.path.exists(Upgrade.UbuntuPath): result = open(Upgrade.UbuntuPath, 'r').read() if result.find('22.04') > -1: lscpdSelection = 'lscpd.0.4.0' - else: - lscpdSelection = 'lscpd.aarch64' - except: - - lscpdSelection = 'lscpd-0.3.1' - if os.path.exists(Upgrade.UbuntuPath): - result = open(Upgrade.UbuntuPath, 'r').read() - if result.find('22.04') > -1: - lscpdSelection = 'lscpd.0.4.0' + command = f'cp -f /usr/local/CyberCP/{lscpdSelection} /usr/local/lscp/bin/{lscpdSelection}' + Upgrade.executioner(command, command, 0) - command = f'cp -f /usr/local/CyberCP/{lscpdSelection} /usr/local/lscp/bin/{lscpdSelection}' - Upgrade.executioner(command, command, 0) + command = 'rm -f /usr/local/lscp/bin/lscpd' + Upgrade.executioner(command, command, 0) - command = 'rm -f /usr/local/lscp/bin/lscpd' - Upgrade.executioner(command, command, 0) + command = f'mv /usr/local/lscp/bin/{lscpdSelection} /usr/local/lscp/bin/lscpd' + Upgrade.executioner(command, command, 0) - command = f'mv /usr/local/lscp/bin/{lscpdSelection} /usr/local/lscp/bin/lscpd' - Upgrade.executioner(command, command, 0) + command = f'chmod 755 {lscpdPath}' + Upgrade.executioner(command, 'LSCPD Download.', 0) - command = f'chmod 755 {lscpdPath}' - Upgrade.executioner(command, 'LSCPD Download.', 0) + command = 'yum -y install pcre-devel openssl-devel expat-devel geoip-devel zlib-devel udns-devel which curl' + Upgrade.executioner(command, 'LSCPD Pre-reqs [two]', 0) - command = 'yum -y install pcre-devel openssl-devel expat-devel geoip-devel zlib-devel udns-devel which curl' - Upgrade.executioner(command, 'LSCPD Pre-reqs [two]', 0) + try: + pwd.getpwnam('lscpd') + except KeyError: + command = 'adduser lscpd -M -d /usr/local/lscp' + Upgrade.executioner(command, 'Add user LSCPD', 0) - try: - pwd.getpwnam('lscpd') - except KeyError: - command = 'adduser lscpd -M -d /usr/local/lscp' - Upgrade.executioner(command, 'Add user LSCPD', 0) + try: + grp.getgrnam('lscpd') + except KeyError: + command = 'groupadd lscpd' + Upgrade.executioner(command, 'Add group LSCPD', 0) - try: - grp.getgrnam('lscpd') - except KeyError: - command = 'groupadd lscpd' + command = 'usermod -a -G lscpd lscpd' Upgrade.executioner(command, 'Add group LSCPD', 0) - command = 'usermod -a -G lscpd lscpd' - Upgrade.executioner(command, 'Add group LSCPD', 0) + command = 'usermod -a -G lsadm lscpd' + Upgrade.executioner(command, 'Add group LSCPD', 0) - command = 'usermod -a -G lsadm lscpd' - Upgrade.executioner(command, 'Add group LSCPD', 0) + command = 'systemctl daemon-reload' + Upgrade.executioner(command, 'daemon-reload LSCPD', 0) - command = 'systemctl daemon-reload' - Upgrade.executioner(command, 'daemon-reload LSCPD', 0) + command = 'systemctl restart lscpd' + Upgrade.executioner(command, 'Restart LSCPD', 0) - command = 'systemctl restart lscpd' - Upgrade.executioner(command, 'Restart LSCPD', 0) + os.chdir(cwd) - os.chdir(cwd) - - Upgrade.stdOut("LSCPD successfully installed!") + Upgrade.stdOut("LSCPD successfully installed!") except BaseException as msg: Upgrade.stdOut(str(msg) + " [installLSCPD]") @@ -2907,168 +2909,165 @@ def upgrade(branch): # Upgrade.stdOut("Upgrades are currently disabled") # return 0 - if branch.find('SoftUpgrade') == -1: - - if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath): - command = 'yum list installed' - Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() - else: - command = 'apt list' - Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() + if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath): + command = 'yum list installed' + Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() + else: + command = 'apt list' + Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() - command = 'systemctl stop cpssh' - Upgrade.executioner(command, 'fix csf if there', 0) + command = 'systemctl stop cpssh' + Upgrade.executioner(command, 'fix csf if there', 0) - ## Add LSPHP7.4 TO LSWS Ent configs + ## Add LSPHP7.4 TO LSWS Ent configs - if not os.path.exists('/usr/local/lsws/bin/openlitespeed'): + if not os.path.exists('/usr/local/lsws/bin/openlitespeed'): - if os.path.exists('httpd_config.xml'): - os.remove('httpd_config.xml') + if os.path.exists('httpd_config.xml'): + os.remove('httpd_config.xml') - command = 'wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/litespeed/httpd_config.xml' - Upgrade.executioner(command, command, 0) - # os.remove('/usr/local/lsws/conf/httpd_config.xml') - # shutil.copy('httpd_config.xml', '/usr/local/lsws/conf/httpd_config.xml') + command = 'wget https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/litespeed/httpd_config.xml' + Upgrade.executioner(command, command, 0) + # os.remove('/usr/local/lsws/conf/httpd_config.xml') + # shutil.copy('httpd_config.xml', '/usr/local/lsws/conf/httpd_config.xml') - postfixPath = '/home/cyberpanel/postfix' - pdns = '/home/cyberpanel/pdns' - pureftpd = '/home/cyberpanel/ftp' - Upgrade.updateRepoURL() + Upgrade.updateRepoURL() - os.chdir("/usr/local") + os.chdir("/usr/local") + if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath): command = 'yum remove yum-plugin-priorities -y' Upgrade.executioner(command, 'remove yum-plugin-priorities', 0) - ## Current Version - - command = "systemctl stop lscpd" - Upgrade.executioner(command, 'stop lscpd', 0) - - Upgrade.fixSudoers() - Upgrade.mountTemp() - Upgrade.dockerUsers() - Upgrade.setupComposer() + ## Current Version - ## - versionNumbring = Upgrade.downloadLink() + ### if this is a soft upgrade from front end do not stop lscpd, as lscpd is controlling the front end - if os.path.exists('/usr/local/CyberPanel.' + versionNumbring): - os.remove('/usr/local/CyberPanel.' + versionNumbring) + if branch.find('SoftUpgrade') == -1: + command = "systemctl stop lscpd" + Upgrade.executioner(command, 'stop lscpd', 0) - ## + Upgrade.fixSudoers() + #Upgrade.mountTemp() + Upgrade.dockerUsers() + Upgrade.setupComposer() - Upgrade.downloadAndUpgrade(versionNumbring, branch) - Upgrade.download_install_phpmyadmin() - Upgrade.downoad_and_install_raindloop() + ## - ## + versionNumbring = Upgrade.downloadLink() - ## + if os.path.exists('/usr/local/CyberPanel.' + versionNumbring): + os.remove('/usr/local/CyberPanel.' + versionNumbring) - Upgrade.mailServerMigrations() - Upgrade.emailMarketingMigrationsa() - Upgrade.dockerMigrations() - Upgrade.CLMigrations() - Upgrade.IncBackupMigrations() - Upgrade.installRestic() + ## - ## + Upgrade.downloadAndUpgrade(versionNumbring, branch) + Upgrade.download_install_phpmyadmin() + Upgrade.downoad_and_install_raindloop() - # Upgrade.setupVirtualEnv() + ## - ## + ## - Upgrade.applyLoginSystemMigrations() + Upgrade.mailServerMigrations() + Upgrade.emailMarketingMigrationsa() + Upgrade.dockerMigrations() + Upgrade.CLMigrations() + Upgrade.IncBackupMigrations() + Upgrade.installRestic() - ## Put function here to update custom ACLs + ## - Upgrade.UpdateConfigOfCustomACL() + # Upgrade.setupVirtualEnv() - Upgrade.s3BackupMigrations() - Upgrade.containerMigrations() - Upgrade.manageServiceMigrations() - Upgrade.enableServices() + ## - Upgrade.installPHP73() - Upgrade.setupCLI() - Upgrade.someDirectories() - Upgrade.installLSCPD(branch) + Upgrade.applyLoginSystemMigrations() - ### General migrations are not needed any more + ## Put function here to update custom ACLs - # Upgrade.GeneralMigrations() + Upgrade.UpdateConfigOfCustomACL() - # Upgrade.p3() + Upgrade.s3BackupMigrations() + Upgrade.containerMigrations() + Upgrade.manageServiceMigrations() + Upgrade.enableServices() - ## Also disable email service upgrade + Upgrade.installPHP73() + Upgrade.setupCLI() + Upgrade.someDirectories() + Upgrade.installLSCPD(branch) - # if os.path.exists(postfixPath): - # Upgrade.upgradeDovecot() + ### General migrations are not needed any more - ## Upgrade version + # Upgrade.GeneralMigrations() - Upgrade.fixPermissions() + # Upgrade.p3() - ## + ## Also disable email service upgrade - ### Disable version upgrade too + # if os.path.exists(postfixPath): + # Upgrade.upgradeDovecot() - # Upgrade.upgradeVersion() + ## Upgrade version - Upgrade.UpdateMaxSSLCons() + Upgrade.fixPermissions() - ## Update LSCPD PHP + ## - phpPath = '/usr/local/lscp/fcgi-bin/lsphp' + ### Disable version upgrade too - try: - os.remove(phpPath) - except: - pass + # Upgrade.upgradeVersion() - command = 'cp /usr/local/lsws/lsphp80/bin/lsphp %s' % (phpPath) - Upgrade.executioner(command, 0) + Upgrade.UpdateMaxSSLCons() - try: - command = "systemctl start lscpd" - Upgrade.executioner(command, 'Start LSCPD', 0) - except: - pass + ## Update LSCPD PHP - command = 'csf -uf' - Upgrade.executioner(command, 'fix csf if there', 0) - command = 'systemctl stop cpssh' - Upgrade.executioner(command, 'fix csf if there', 0) - Upgrade.AutoUpgradeAcme() - Upgrade.installCLScripts() - Upgrade.runSomeImportantBash() - - # ## Move static files - # - # imunifyPath = '/usr/local/CyberCP/public/imunify' - # - # if os.path.exists(imunifyPath): - # command = "yum reinstall imunify360-firewall-generic -y" - # Upgrade.executioner(command, command, 1) - # - imunifyAVPath = '/etc/sysconfig/imunify360/integration.conf' + phpPath = '/usr/local/lscp/fcgi-bin/lsphp' - if os.path.exists(imunifyAVPath): - execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/CLManager/CageFS.py" - command = execPath + " --function submitinstallImunifyAV" - Upgrade.executioner(command, command, 1) + try: + os.remove(phpPath) + except: + pass - command = 'chmod +x /usr/local/CyberCP/public/imunifyav/bin/execute.py' - Upgrade.executioner(command, command, 1) + command = 'cp /usr/local/lsws/lsphp80/bin/lsphp %s' % (phpPath) + Upgrade.executioner(command, 0) - Upgrade.stdOut("Upgrade Completed.") - else: + try: + command = "systemctl start lscpd" + Upgrade.executioner(command, 'Start LSCPD', 0) + except: pass + command = 'csf -uf' + Upgrade.executioner(command, 'fix csf if there', 0) + command = 'systemctl stop cpssh' + Upgrade.executioner(command, 'fix csf if there', 0) + Upgrade.AutoUpgradeAcme() + Upgrade.installCLScripts() + Upgrade.runSomeImportantBash() + + # ## Move static files + # + # imunifyPath = '/usr/local/CyberCP/public/imunify' + # + # if os.path.exists(imunifyPath): + # command = "yum reinstall imunify360-firewall-generic -y" + # Upgrade.executioner(command, command, 1) + # + imunifyAVPath = '/etc/sysconfig/imunify360/integration.conf' + + if os.path.exists(imunifyAVPath): + execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/CLManager/CageFS.py" + command = execPath + " --function submitinstallImunifyAV" + Upgrade.executioner(command, command, 1) + + command = 'chmod +x /usr/local/CyberCP/public/imunifyav/bin/execute.py' + Upgrade.executioner(command, command, 1) + + Upgrade.stdOut("Upgrade Completed.") def main(): diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index 28e2d86da..9448a18a7 100755 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -119,27 +119,7 @@

-
- -
- -
-
-
- -
- -
-