diff --git a/install/install.py b/install/install.py index a7445b4b0..346fd1c05 100644 --- a/install/install.py +++ b/install/install.py @@ -9,7 +9,7 @@ from firewallUtilities import FirewallUtilities import time import string import random -import errno +import socket from os.path import * from stat import * @@ -192,7 +192,7 @@ class preFlightsChecks: while (1): - command = "mkdir /etc/letsencrypt" + command = "mkdir -p /etc/letsencrypt/live/" cmd = shlex.split(command) @@ -617,6 +617,18 @@ class preFlightsChecks: preFlightsChecks.stdOut("MySQL-python successfully installed!") break + if self.distro == ubuntu: + command = "pip install MySQL-python" + res = subprocess.call(shlex.split(command)) + if res != 0: + logging.InstallLog.writeToFile( + "Unable to install MySQL-python, exiting installer! [install_python_mysql_library] Error: " + str( + res)) + preFlightsChecks.stdOut( + "Unable to install MySQL-python, exiting installer! [install_python_mysql_library] Error: " + str( + res)) + os._exit(os.EX_OSERR) + def install_gunicorn(self): self.stdOut("Install GUnicorn") count = 0 @@ -1268,7 +1280,6 @@ class preFlightsChecks: return 1 - def setup_email_Passwords(self,mysqlPassword, mysql): try: @@ -1383,7 +1394,6 @@ class preFlightsChecks: return 1 - def setup_postfix_davecot_config(self, mysql): try: logging.InstallLog.writeToFile("Configuring postfix and dovecot...") @@ -1979,9 +1989,7 @@ class preFlightsChecks: while(1): command = "chmod 755 "+main - cmd = shlex.split(command) - res = subprocess.call(cmd) if res == 1: @@ -1995,6 +2003,19 @@ class preFlightsChecks: preFlightsChecks.stdOut("Permissions changed for /etc/postfix/main.cf!") break + if self.distro == ubuntu: + command = "mkdir -p /etc/pki/dovecot/private/" + cmd = shlex.split(command) + res = subprocess.call(cmd) + + command = "mkdir -p /etc/opendkim/keys/" + cmd = shlex.split(command) + res = subprocess.call(cmd) + + command = "sed -i 's/auth_mechanisms = plain/#auth_mechanisms = plain/g' /etc/dovecot/conf.d/10-auth.conf" + subprocess.call(shlex.split(command)) + + logging.InstallLog.writeToFile("Postfix and Dovecot configured") except OSError, msg: @@ -2006,7 +2027,6 @@ class preFlightsChecks: return 1 - def downoad_and_install_raindloop(self): try: ########### @@ -2188,9 +2208,6 @@ class preFlightsChecks: def installFirewalld(self): try: - if self.distro == ubuntu: - return 0 # Uses AppArmor - preFlightsChecks.stdOut("Enabling Firewall!") count = 0 @@ -2342,6 +2359,17 @@ class preFlightsChecks: logging.InstallLog.writeToFile("LSCPD Successfully enabled at system startup!") preFlightsChecks.stdOut("LSCPD Successfully enabled at system startup!") break + ## + count = 0 + + # In Ubuntu, the library that lscpd looks for is libpcre.so.1, but the one it installs is libpcre.so.3... + if self.distro == ubuntu: + command = 'ln -s /lib/x86_64-linux-gnu/libpcre.so.3 /lib/x86_64-linux-gnu/libpcre.so.1' + res = subprocess.call(shlex.split(command)) + if res == 0: + self.stdOut("Created ubuntu symbolic link to pcre") + else: + self.stdOut("Error creating symbolic link to pcre: " + str(res)) ## @@ -2786,6 +2814,13 @@ class preFlightsChecks: preFlightsChecks.stdOut("Succcessfully installed opendkim!") break + if self.distro == ubuntu: + command = 'apt install opendkim-tools' + subprocess.call(shlex.split(command)) + + command = 'mkdir -p /etc/opendkim/keys/' + subprocess.call(shlex.split(command)) + except OSError, msg: logging.InstallLog.writeToFile(str(msg) + " [installOpenDKIM]") @@ -3287,7 +3322,7 @@ def main(): import installCyberPanel - installCyberPanel.Main(cwd, mysql) + installCyberPanel.Main(cwd, mysql, distro) checks.fix_selinux_issue() checks.install_psmisc() checks.install_postfix_davecot() @@ -3325,7 +3360,7 @@ def main(): checks.configureOpenDKIM() checks.modSecPreReqs() - checks.setupVirtualEnv() + checks.setupVirtualEnv(distro) checks.setupPHPAndComposer() if args.postfix != None: @@ -3347,6 +3382,7 @@ def main(): checks.enableDisableFTP('On') logging.InstallLog.writeToFile("CyberPanel installation successfully completed!") + checks.installation_successfull() if __name__ == "__main__": diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index e085e46df..7471d113b 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -3,7 +3,6 @@ import subprocess import os import pexpect from mysqlUtilities import mysqlUtilities -import install import installLog as logging import shlex import randomPassword @@ -1265,7 +1264,6 @@ def Main(cwd, mysql, distro): mysqlUtilities.createDatabaseCyberPanel("cyberpanel","cyberpanel",InstallCyberPanel.mysqlPassword, mysql) - installer.installPureFTPD() installer.installPureFTPDConfigurations(mysql) installer.startPureFTPD() diff --git a/plogical/sslUtilities.py b/plogical/sslUtilities.py index 70228c66b..13b66b51f 100644 --- a/plogical/sslUtilities.py +++ b/plogical/sslUtilities.py @@ -158,8 +158,12 @@ class sslUtilities: @staticmethod def obtainSSLForADomain(virtualHostName,adminEmail,sslpath, aliasDomain = None): try: + acmePath = '/root/.acme.sh/acme.sh' - if not os.path.exists('/root/.acme.sh/acme.sh'): + if os.path.exists('/etc/lsb-release'): + acmePath = '/home/cyberpanel/.acme.sh/acme.sh' + + if not os.path.exists(acmePath): command = 'wget -O - https://get.acme.sh | sh' subprocess.call(command, shell=True) @@ -173,7 +177,7 @@ class sslUtilities: try: logging.CyberCPLogFileWriter.writeToFile("Trying to obtain SSL for: " + virtualHostName + " and: www." + virtualHostName) - command = "/root/.acme.sh/acme.sh --issue -d " + virtualHostName + " -d www." + virtualHostName \ + command = acmePath + " --issue -d " + virtualHostName + " -d www." + virtualHostName \ + ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \ + ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force' @@ -187,7 +191,7 @@ class sslUtilities: try: logging.CyberCPLogFileWriter.writeToFile("Trying to obtain SSL for: " + virtualHostName) - command = "/root/.acme.sh/acme.sh --issue -d " + virtualHostName + ' --cert-file ' + existingCertPath \ + command = acmePath + " --issue -d " + virtualHostName + ' --cert-file ' + existingCertPath \ + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \ + ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force' output = subprocess.check_output(shlex.split(command)) @@ -206,7 +210,7 @@ class sslUtilities: logging.CyberCPLogFileWriter.writeToFile( "Trying to obtain SSL for: " + virtualHostName + ", www." + virtualHostName + ", " + aliasDomain + " and www." + aliasDomain + ",") - command = "/root/.acme.sh/acme.sh --issue -d " + virtualHostName + " -d www." + virtualHostName \ + command = acmePath + " --issue -d " + virtualHostName + " -d www." + virtualHostName \ + ' -d ' + aliasDomain + ' -d www.' + aliasDomain\ + ' --cert-file ' + existingCertPath + '/cert.pem' + ' --key-file ' + existingCertPath + '/privkey.pem' \ + ' --fullchain-file ' + existingCertPath + '/fullchain.pem' + ' -w ' + sslpath + ' --force'