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
|
count = 0
|
||||||
|
|
||||||
while(1):
|
while(1):
|
||||||
cmd = []
|
if self.distro == ubuntu:
|
||||||
|
command = 'systemctl start pure-ftpd-mysql'
|
||||||
cmd.append("systemctl")
|
else:
|
||||||
cmd.append("start")
|
command = 'systemctl start pure-ftpd'
|
||||||
cmd.append(install.preFlightsChecks.pureFTPDServiceName(self.distro))
|
res = subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
res = subprocess.call(cmd)
|
|
||||||
|
|
||||||
if res == 1:
|
if res == 1:
|
||||||
count = count + 1
|
count = count + 1
|
||||||
@@ -854,6 +852,7 @@ class InstallCyberPanel:
|
|||||||
try:
|
try:
|
||||||
os.mkdir('/etc/pure-ftpd/conf')
|
os.mkdir('/etc/pure-ftpd/conf')
|
||||||
os.mkdir('/etc/pure-ftpd/auth')
|
os.mkdir('/etc/pure-ftpd/auth')
|
||||||
|
os.mkdir('/etc/pure-ftpd/db')
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
self.stdOut("Error creating extra pure-ftpd directories: " + str(err), ". Should be ok", 1)
|
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")
|
writeDataToFile = open(ftpdPath+"/pureftpd-mysql.conf","w")
|
||||||
|
|
||||||
dataWritten = "MYSQLPassword "+InstallCyberPanel.mysqlPassword+'\n'
|
dataWritten = "MYSQLPassword "+InstallCyberPanel.mysqlPassword+'\n'
|
||||||
|
|
||||||
|
|
||||||
for items in data:
|
for items in data:
|
||||||
if items.find("MYSQLPassword")>-1:
|
if items.find("MYSQLPassword")>-1:
|
||||||
writeDataToFile.writelines(dataWritten)
|
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-ldap.conf', stat.S_IRUSR | stat.S_IWUSR)
|
||||||
os.chmod(ftpdPath + '/pureftpd-pgsql.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!")
|
logging.InstallLog.writeToFile("PureFTPD configured!")
|
||||||
InstallCyberPanel.stdOut("PureFTPD configured!")
|
InstallCyberPanel.stdOut("PureFTPD configured!")
|
||||||
|
|
||||||
@@ -1254,8 +1267,6 @@ def Main(cwd, mysql, distro):
|
|||||||
password = open(file_name, "w")
|
password = open(file_name, "w")
|
||||||
password.writelines(InstallCyberPanel.mysql_Root_password)
|
password.writelines(InstallCyberPanel.mysql_Root_password)
|
||||||
|
|
||||||
os.fchmod(password.fileno(), stat.S_IRUSR | stat.S_IWUSR)
|
|
||||||
|
|
||||||
password.close()
|
password.close()
|
||||||
|
|
||||||
if distro == centos:
|
if distro == centos:
|
||||||
|
|||||||
@@ -193,18 +193,22 @@ def saveStatus(request):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
elif service == 'pureftpd':
|
elif service == 'pureftpd':
|
||||||
|
if os.path.exists("/etc/lsb-release"):
|
||||||
|
serviceName = 'pure-ftpd-mysql'
|
||||||
|
else:
|
||||||
|
serviceName = 'pure-ftpd'
|
||||||
|
|
||||||
servicePath = '/home/cyberpanel/pureftpd'
|
servicePath = '/home/cyberpanel/pureftpd'
|
||||||
if status == True:
|
if status == True:
|
||||||
writeToFile = open(servicePath, 'w+')
|
writeToFile = open(servicePath, 'w+')
|
||||||
writeToFile.close()
|
writeToFile.close()
|
||||||
command = 'sudo systemctl start pure-ftpd'
|
command = 'sudo systemctl start ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
else:
|
else:
|
||||||
command = 'sudo systemctl stop pure-ftpd'
|
command = 'sudo systemctl stop ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo systemctl disable pure-ftpd'
|
command = 'sudo systemctl disable ' + serviceName
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -61,12 +61,15 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
def installGit(self):
|
def installGit(self):
|
||||||
try:
|
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'
|
command = 'sudo yum install git -y'
|
||||||
subprocess.call(shlex.split(command))
|
subprocess.call(shlex.split(command))
|
||||||
|
|
||||||
command = 'sudo yum install git -y'
|
|
||||||
subprocess.call(shlex.split(command))
|
|
||||||
|
|
||||||
except BaseException, msg:
|
except BaseException, msg:
|
||||||
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installGit]')
|
logging.writeToFile( str(msg) + ' [ApplicationInstaller.installGit]')
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ class vhost:
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
FNULL = open(os.devnull, 'w')
|
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)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|||||||
@@ -1244,6 +1244,7 @@ class WebsiteManager:
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
# Confirming that directory is read/writable
|
# Confirming that directory is read/writable
|
||||||
|
|
||||||
o = subprocess.call(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
o = subprocess.call(['sudo', 'chown', 'cyberpanel:cyberpanel', tempPath])
|
||||||
if o is not 0:
|
if o is not 0:
|
||||||
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
data_ret = {'addNewCron': 0, 'error_message': 'Error Changing Permissions'}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import psutil
|
|||||||
import shlex
|
import shlex
|
||||||
import socket
|
import socket
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
import os
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
def serverStatusHome(request):
|
def serverStatusHome(request):
|
||||||
@@ -271,6 +272,11 @@ def servicesAction(request):
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
else:
|
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)
|
command = 'sudo systemctl %s %s' % (action, service)
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
|
|||||||
Reference in New Issue
Block a user