mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
ftp fix for ubuntu
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -61,7 +61,10 @@ 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))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
@@ -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'}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user