diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py index ca265ac22..563dc29e1 100644 --- a/install/installCyberPanel.py +++ b/install/installCyberPanel.py @@ -775,13 +775,11 @@ class InstallCyberPanel: count = 0 while(1): - cmd = [] - - cmd.append("systemctl") - cmd.append("start") - cmd.append(install.preFlightsChecks.pureFTPDServiceName(self.distro)) - - res = subprocess.call(cmd) + if self.distro == ubuntu: + command = 'systemctl start pure-ftpd-mysql' + else: + command = 'systemctl start pure-ftpd' + res = subprocess.call(shlex.split(command)) if res == 1: count = count + 1 @@ -854,6 +852,7 @@ class InstallCyberPanel: try: os.mkdir('/etc/pure-ftpd/conf') os.mkdir('/etc/pure-ftpd/auth') + os.mkdir('/etc/pure-ftpd/db') except OSError as err: self.stdOut("Error creating extra pure-ftpd directories: " + str(err), ". Should be ok", 1) @@ -862,8 +861,6 @@ class InstallCyberPanel: writeDataToFile = open(ftpdPath+"/pureftpd-mysql.conf","w") dataWritten = "MYSQLPassword "+InstallCyberPanel.mysqlPassword+'\n' - - for items in data: if items.find("MYSQLPassword")>-1: writeDataToFile.writelines(dataWritten) @@ -876,6 +873,22 @@ class InstallCyberPanel: os.chmod(ftpdPath + '/pureftpd-ldap.conf', stat.S_IRUSR | stat.S_IWUSR) os.chmod(ftpdPath + '/pureftpd-pgsql.conf', stat.S_IRUSR | stat.S_IWUSR) + if self.distro == ubuntu: + command = 'apt install pure-ftpd-mysql -y' + subprocess.call(shlex.split(command)) + + 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') + else: + shutil.copy(ftpdPath + "/pureftpd-mysql.conf", '/etc/pure-ftpd/db/mysql.conf') + + command = 'echo 1 > /etc/pure-ftpd/conf/TLS' + subprocess.call(command, shell=True) + + command = 'systemctl restart pure-ftpd-mysql.service' + subprocess.call(shlex.split(command)) + logging.InstallLog.writeToFile("PureFTPD configured!") InstallCyberPanel.stdOut("PureFTPD configured!") @@ -1254,8 +1267,6 @@ def Main(cwd, mysql, distro): password = open(file_name, "w") password.writelines(InstallCyberPanel.mysql_Root_password) - os.fchmod(password.fileno(), stat.S_IRUSR | stat.S_IWUSR) - password.close() if distro == centos: diff --git a/manageServices/views.py b/manageServices/views.py index 6e0df0dc4..399e62479 100644 --- a/manageServices/views.py +++ b/manageServices/views.py @@ -193,18 +193,22 @@ def saveStatus(request): pass elif service == 'pureftpd': + if os.path.exists("/etc/lsb-release"): + serviceName = 'pure-ftpd-mysql' + else: + serviceName = 'pure-ftpd' servicePath = '/home/cyberpanel/pureftpd' if status == True: writeToFile = open(servicePath, 'w+') writeToFile.close() - command = 'sudo systemctl start pure-ftpd' + command = 'sudo systemctl start ' + serviceName subprocess.call(shlex.split(command)) else: - command = 'sudo systemctl stop pure-ftpd' + command = 'sudo systemctl stop ' + serviceName subprocess.call(shlex.split(command)) - command = 'sudo systemctl disable pure-ftpd' + command = 'sudo systemctl disable ' + serviceName subprocess.call(shlex.split(command)) try: diff --git a/plogical/applicationInstaller.py b/plogical/applicationInstaller.py index f0e2db753..5e756f774 100644 --- a/plogical/applicationInstaller.py +++ b/plogical/applicationInstaller.py @@ -61,12 +61,15 @@ class ApplicationInstaller(multi.Thread): def installGit(self): try: + if os.path.exists("/etc/lsb-release"): + command = 'apt -y install git' + subprocess.call(shlex.split(command)) + else: + command = 'sudo yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm' + subprocess.call(shlex.split(command)) - command = 'sudo yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm' - subprocess.call(shlex.split(command)) - - command = 'sudo yum install git -y' - subprocess.call(shlex.split(command)) + command = 'sudo yum install git -y' + subprocess.call(shlex.split(command)) except BaseException, msg: logging.writeToFile( str(msg) + ' [ApplicationInstaller.installGit]') diff --git a/plogical/vhost.py b/plogical/vhost.py index e88d67508..a8aa849ce 100644 --- a/plogical/vhost.py +++ b/plogical/vhost.py @@ -31,8 +31,11 @@ class vhost: try: FNULL = open(os.devnull, 'w') + if os.path.exists("/etc/lsb-release"): + command = 'adduser --no-create-home --home ' + path + ' --disabled-login --gecos "" ' + virtualHostUser + else: + command = "adduser " + virtualHostUser + " -M -d " + path - command = "adduser " + virtualHostUser + " -M -d " + path cmd = shlex.split(command) subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT) diff --git a/plogical/website.py b/plogical/website.py index 3df1a411a..29d785010 100644 --- a/plogical/website.py +++ b/plogical/website.py @@ -1244,6 +1244,7 @@ class WebsiteManager: return HttpResponse(final_json) # Confirming that directory is read/writable + o = subprocess.call(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath]) if o is not 0: data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'} diff --git a/serverStatus/views.py b/serverStatus/views.py index be36afba3..623bd8f1f 100644 --- a/serverStatus/views.py +++ b/serverStatus/views.py @@ -12,6 +12,7 @@ import psutil import shlex import socket from plogical.acl import ACLManager +import os # Create your views here. def serverStatusHome(request): @@ -271,6 +272,11 @@ def servicesAction(request): return HttpResponse(final_json) else: + if service == 'pure-ftpd': + if os.path.exists("/etc/lsb-release"): + service = 'pure-ftpd-mysql' + else: + service = 'pure-ftpd' command = 'sudo systemctl %s %s' % (action, service) cmd = shlex.split(command)