mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 07:46:10 +01:00
Merge branch 'v2.1.1' into v2.1.1-usman
This commit is contained in:
@@ -72,7 +72,7 @@ class secMiddleware:
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
if request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('filemanager') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1:
|
||||
if request.build_absolute_uri().find('api/verifyConn') > -1 or request.build_absolute_uri().find('webhook') > -1 or request.build_absolute_uri().find('saveSpamAssassinConfigurations') > -1 or request.build_absolute_uri().find('docker') > -1 or request.build_absolute_uri().find('cloudAPI') > -1 or request.build_absolute_uri().find('verifyLogin') > -1 or request.build_absolute_uri().find('submitUserCreation') > -1:
|
||||
continue
|
||||
if key == 'recordContentAAAA' or key == 'backupDestinations' or key == 'ports' \
|
||||
or key == 'imageByPass' or key == 'passwordByPass' or key == 'cronCommand' \
|
||||
|
||||
@@ -15,6 +15,7 @@ centos=0
|
||||
ubuntu = 1
|
||||
cent8 = 2
|
||||
|
||||
|
||||
def get_Ubuntu_release():
|
||||
release = -1
|
||||
if exists("/etc/lsb-release"):
|
||||
@@ -34,12 +35,13 @@ def get_Ubuntu_release():
|
||||
|
||||
return release
|
||||
|
||||
class InstallCyberPanel:
|
||||
|
||||
class InstallCyberPanel:
|
||||
mysql_Root_password = ""
|
||||
mysqlPassword = ""
|
||||
|
||||
def __init__(self, rootPath, cwd, distro, ent, serial = None, port = None, ftp = None, dns = None, publicip = None, remotemysql = None , mysqlhost = None, mysqldb = None, mysqluser = None, mysqlpassword = None, mysqlport = None):
|
||||
def __init__(self, rootPath, cwd, distro, ent, serial=None, port=None, ftp=None, dns=None, publicip=None,
|
||||
remotemysql=None, mysqlhost=None, mysqldb=None, mysqluser=None, mysqlpassword=None, mysqlport=None):
|
||||
self.server_root_path = rootPath
|
||||
self.cwd = cwd
|
||||
self.distro = distro
|
||||
@@ -208,7 +210,6 @@ class InstallCyberPanel:
|
||||
|
||||
## only php 71
|
||||
if self.distro == centos:
|
||||
|
||||
command = 'yum install lsphp71 lsphp71-json lsphp71-xmlrpc lsphp71-xml lsphp71-soap lsphp71-snmp ' \
|
||||
'lsphp71-recode lsphp71-pspell lsphp71-process lsphp71-pgsql lsphp71-pear lsphp71-pdo lsphp71-opcache ' \
|
||||
'lsphp71-odbc lsphp71-mysqlnd lsphp71-mcrypt lsphp71-mbstring lsphp71-ldap lsphp71-intl lsphp71-imap ' \
|
||||
@@ -223,7 +224,6 @@ class InstallCyberPanel:
|
||||
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
|
||||
## only php 73
|
||||
command = 'yum install -y lsphp73 lsphp73-json lsphp73-xmlrpc lsphp73-xml lsphp73-tidy lsphp73-soap lsphp73-snmp ' \
|
||||
'lsphp73-recode lsphp73-pspell lsphp73-process lsphp73-pgsql lsphp73-pear lsphp73-pdo lsphp73-opcache ' \
|
||||
@@ -277,13 +277,14 @@ class InstallCyberPanel:
|
||||
|
||||
self.startMariaDB()
|
||||
|
||||
|
||||
def changeMYSQLRootPassword(self):
|
||||
if self.remotemysql == 'OFF':
|
||||
if self.distro == ubuntu:
|
||||
passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';UPDATE user SET plugin='' WHERE User='root';flush privileges;" % (InstallCyberPanel.mysql_Root_password)
|
||||
passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';UPDATE user SET plugin='' WHERE User='root';flush privileges;" % (
|
||||
InstallCyberPanel.mysql_Root_password)
|
||||
else:
|
||||
passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';flush privileges;" % (InstallCyberPanel.mysql_Root_password)
|
||||
passwordCMD = "use mysql;DROP DATABASE IF EXISTS test;DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%%';GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '%s';flush privileges;" % (
|
||||
InstallCyberPanel.mysql_Root_password)
|
||||
|
||||
command = 'mysql -u root -e "' + passwordCMD + '"'
|
||||
|
||||
@@ -367,7 +368,6 @@ class InstallCyberPanel:
|
||||
command = 'dnf install pure-ftpd -y'
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||
|
||||
|
||||
####### Install pureftpd to system startup
|
||||
|
||||
command = "systemctl enable " + install.preFlightsChecks.pureFTPDServiceName(self.distro)
|
||||
@@ -400,7 +400,8 @@ class InstallCyberPanel:
|
||||
except:
|
||||
logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL")
|
||||
|
||||
if (self.distro == centos or self.distro == cent8) or (self.distro == ubuntu and get_Ubuntu_release() == 18.14):
|
||||
if (self.distro == centos or self.distro == cent8) or (
|
||||
self.distro == ubuntu and get_Ubuntu_release() == 18.14):
|
||||
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
|
||||
else:
|
||||
command = 'openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
|
||||
@@ -441,7 +442,6 @@ class InstallCyberPanel:
|
||||
else:
|
||||
writeDataToFile.writelines(items)
|
||||
|
||||
|
||||
writeDataToFile.close()
|
||||
|
||||
ftpConfPath = '/etc/pure-ftpd/pureftpd-mysql.conf'
|
||||
@@ -479,7 +479,6 @@ class InstallCyberPanel:
|
||||
command = 'echo "/etc/pure-ftpd/db/mysql.conf" > /etc/pure-ftpd/conf/MySQLConfigFile'
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
|
||||
command = 'ln -s /etc/pure-ftpd/conf/MySQLConfigFile /etc/pure-ftpd/auth/30mysql'
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||
|
||||
@@ -504,7 +503,6 @@ class InstallCyberPanel:
|
||||
command = 'systemctl disable systemd-resolved.service'
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
|
||||
try:
|
||||
os.rename('/etc/resolv.conf', 'etc/resolved.conf')
|
||||
except OSError as e:
|
||||
@@ -514,11 +512,10 @@ class InstallCyberPanel:
|
||||
try:
|
||||
os.remove('/etc/resolv.conf')
|
||||
except OSError as e1:
|
||||
InstallCyberPanel.stdOut("[ERROR] Unable to remove existing /etc/resolv.conf to install PowerDNS: " +
|
||||
InstallCyberPanel.stdOut(
|
||||
"[ERROR] Unable to remove existing /etc/resolv.conf to install PowerDNS: " +
|
||||
str(e1), 1, 1, os.EX_OSERR)
|
||||
|
||||
|
||||
|
||||
# try:
|
||||
# f = open('/etc/resolv.conf', 'a')
|
||||
# f.write('nameserver 8.8.8.8')
|
||||
@@ -587,7 +584,6 @@ class InstallCyberPanel:
|
||||
|
||||
writeDataToFile.close()
|
||||
|
||||
|
||||
if self.remotemysql == 'ON':
|
||||
command = "sed -i 's|gmysql-host=localhost|gmysql-host=%s|g' %s" % (self.mysqlhost, dnsPath)
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||
@@ -613,8 +609,8 @@ class InstallCyberPanel:
|
||||
install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
|
||||
|
||||
|
||||
def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns = None, publicip = None, remotemysql = None , mysqlhost = None, mysqldb = None, mysqluser = None, mysqlpassword = None, mysqlport = None):
|
||||
|
||||
def Main(cwd, mysql, distro, ent, serial=None, port="8090", ftp=None, dns=None, publicip=None, remotemysql=None,
|
||||
mysqlhost=None, mysqldb=None, mysqluser=None, mysqlpassword=None, mysqlport=None):
|
||||
InstallCyberPanel.mysqlPassword = randomPassword.generate_pass()
|
||||
InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass()
|
||||
|
||||
@@ -630,7 +626,8 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns
|
||||
password.writelines(InstallCyberPanel.mysql_Root_password)
|
||||
password.close()
|
||||
else:
|
||||
mysqlData = {'remotemysql': remotemysql, 'mysqlhost': mysqlhost, 'mysqldb':mysqldb, 'mysqluser': mysqluser, 'mysqlpassword': mysqlpassword, 'mysqlport': mysqlport}
|
||||
mysqlData = {'remotemysql': remotemysql, 'mysqlhost': mysqlhost, 'mysqldb': mysqldb, 'mysqluser': mysqluser,
|
||||
'mysqlpassword': mysqlpassword, 'mysqlport': mysqlport}
|
||||
from json import dumps
|
||||
writeToFile = open(file_name, 'w')
|
||||
writeToFile.write(dumps(mysqlData))
|
||||
@@ -640,8 +637,6 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns
|
||||
print(open(file_name, 'r').read())
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
|
||||
try:
|
||||
command = 'chmod 640 %s' % (file_name)
|
||||
install.preFlightsChecks.call(command, distro, '[chmod]',
|
||||
@@ -659,7 +654,8 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns
|
||||
else:
|
||||
InstallCyberPanel.mysqlPassword = InstallCyberPanel.mysql_Root_password
|
||||
|
||||
installer = InstallCyberPanel("/usr/local/lsws/",cwd, distro, ent, serial, port, ftp, dns, publicip, remotemysql, mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
|
||||
installer = InstallCyberPanel("/usr/local/lsws/", cwd, distro, ent, serial, port, ftp, dns, publicip, remotemysql,
|
||||
mysqlhost, mysqldb, mysqluser, mysqlpassword, mysqlport)
|
||||
|
||||
logging.InstallLog.writeToFile('Installing LiteSpeed Web server,40')
|
||||
installer.installLiteSpeed()
|
||||
|
||||
@@ -272,4 +272,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp72-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -272,4 +272,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp73-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -272,4 +272,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp74-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -272,4 +272,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp80-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -122,4 +122,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp72-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -122,4 +122,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp73-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -122,4 +122,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp74-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
@@ -122,4 +122,10 @@
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
<extension>
|
||||
<extensionName>lsphp80-sodium</extensionName>
|
||||
<extensionDescription>The php-sodium extension provides strong encryption capabilities in an easy and consistent way.</extensionDescription>
|
||||
<status>0</status>
|
||||
</extension>
|
||||
|
||||
</php>
|
||||
|
||||
Reference in New Issue
Block a user