mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 09:46:11 +01:00
bug fix: ftp issue on ubuntu22
This commit is contained in:
@@ -504,6 +504,14 @@ class InstallCyberPanel:
|
||||
command = 'systemctl restart pure-ftpd-mysql.service'
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||
|
||||
|
||||
if get_Ubuntu_release() > 20:
|
||||
### change mysql md5 to crypt
|
||||
|
||||
command = "sed -i 's/MYSQLCrypt md5/MYSQLCrypt crypt/g' /etc/pure-ftpd/db/mysql.conf"
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||
|
||||
|
||||
InstallCyberPanel.stdOut("PureFTPD configured!", 1)
|
||||
|
||||
except IOError as msg:
|
||||
|
||||
@@ -143,8 +143,13 @@ class FTPUtilities:
|
||||
print("0, %s file is symlinked." % (path))
|
||||
return 0
|
||||
|
||||
hash = hashlib.md5()
|
||||
hash.update(password.encode('utf-8'))
|
||||
if ProcessUtilities.ubuntu22Check == 1:
|
||||
from crypt import crypt, METHOD_SHA512
|
||||
FTPPass = crypt(password, METHOD_SHA512)
|
||||
else:
|
||||
hash = hashlib.md5()
|
||||
hash.update(password.encode('utf-8'))
|
||||
FTPPass = hash.hexdigest()
|
||||
|
||||
admin = Administrator.objects.get(userName=owner)
|
||||
|
||||
@@ -153,7 +158,7 @@ class FTPUtilities:
|
||||
|
||||
|
||||
if website.package.ftpAccounts == 0:
|
||||
user = Users(domain=website, user=userName, password=hash.hexdigest(), uid=uid, gid=gid,
|
||||
user = Users(domain=website, user=userName, password=FTPPass, uid=uid, gid=gid,
|
||||
dir=path,
|
||||
quotasize=website.package.diskSpace,
|
||||
status="1",
|
||||
@@ -163,7 +168,7 @@ class FTPUtilities:
|
||||
|
||||
user.save()
|
||||
elif website.users_set.all().count() < website.package.ftpAccounts:
|
||||
user = Users(domain=website, user=userName, password=hash.hexdigest(), uid=uid, gid=gid,
|
||||
user = Users(domain=website, user=userName, password=FTPPass, uid=uid, gid=gid,
|
||||
dir=path, quotasize=website.package.diskSpace,
|
||||
status="1",
|
||||
ulbandwidth=500000,
|
||||
@@ -195,11 +200,16 @@ class FTPUtilities:
|
||||
@staticmethod
|
||||
def changeFTPPassword(userName, password):
|
||||
try:
|
||||
hash = hashlib.md5()
|
||||
hash.update(password.encode('utf-8'))
|
||||
if ProcessUtilities.ubuntu22Check == 1:
|
||||
from crypt import crypt, METHOD_SHA512
|
||||
FTPPass = crypt(password, METHOD_SHA512)
|
||||
else:
|
||||
hash = hashlib.md5()
|
||||
hash.update(password.encode('utf-8'))
|
||||
FTPPass = hash.hexdigest()
|
||||
|
||||
ftp = Users.objects.get(user=userName)
|
||||
ftp.password = hash.hexdigest()
|
||||
ftp.password = FTPPass
|
||||
ftp.save()
|
||||
|
||||
return 1, None
|
||||
|
||||
@@ -17,6 +17,7 @@ class ProcessUtilities(multi.Thread):
|
||||
cent8 = 2
|
||||
ubuntu = 0
|
||||
ubuntu20 = 3
|
||||
ubuntu22Check = 0
|
||||
server_address = '/usr/local/lscpd/admin/comm.sock'
|
||||
token = "unset"
|
||||
portPath = '/usr/local/lscp/conf/bind.conf'
|
||||
@@ -166,6 +167,10 @@ class ProcessUtilities(multi.Thread):
|
||||
distroPath = '/etc/lsb-release'
|
||||
|
||||
if os.path.exists(distroPath):
|
||||
## this is check only
|
||||
if open(distroPath, 'r').read().find('22.04'):
|
||||
ProcessUtilities.ubuntu22Check = 1
|
||||
|
||||
if open(distroPath, 'r').read().find('20.04') > -1 or open(distroPath, 'r').read().find('22.04'):
|
||||
return ProcessUtilities.ubuntu20
|
||||
return ProcessUtilities.ubuntu
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import sys
|
||||
from crypt import crypt, METHOD_SHA512
|
||||
from getpass import getpass
|
||||
|
||||
print(crypt('hosting', METHOD_SHA512))
|
||||
@@ -1085,6 +1085,19 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
### update ftp issue for ubuntu 22
|
||||
|
||||
if Upgrade.FindOperatingSytem() == Ubuntu22:
|
||||
|
||||
try:
|
||||
cursor.execute('ALTER TABLE `users` CHANGE `Password` `Password` VARCHAR(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; ')
|
||||
except:
|
||||
pass
|
||||
|
||||
command = "sed -i 's/MYSQLCrypt md5/MYSQLCrypt crypt/g' /etc/pure-ftpd/db/mysql.conf"
|
||||
Upgrade.executioner(command, command, 1)
|
||||
|
||||
try:
|
||||
connection.close()
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user