mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
Merge branch 'v2.0.4-dev' into v2.0.5-dev
This commit is contained in:
@@ -114,7 +114,7 @@ DATABASES = {
|
|||||||
'USER': 'cyberpanel',
|
'USER': 'cyberpanel',
|
||||||
'PASSWORD': 'Bz9gF7Hr7X4RtD',
|
'PASSWORD': 'Bz9gF7Hr7X4RtD',
|
||||||
'HOST': 'localhost',
|
'HOST': 'localhost',
|
||||||
'PORT':''
|
'PORT': ''
|
||||||
},
|
},
|
||||||
'rootdb': {
|
'rootdb': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3txFD2sk0fG9MX4l8vpvXYn8ymRN8107PCYywxvwIVN2KnWcPvsKreOajdJr6wj07jqXpviolQdkCM+qPRodHmTX5gpRz0GQobik1S1bihc2wTC4CA9WWAolXxBxnUO5FnMJMoB3tWmg+1tpJZnr+ZATFHjCbmTH+Ra5KO/bROt/gYoiiZvEAzLJNrLYOKBZ9Ik6/GBWFLALosjM8wFK6LQrrOzeNSOK7+aActliF0RjssHwi/65H0Hv172GsIecWvWTnOXrkhi134OtQmbSRtnVAMtjaPsWGO1PEJZya2iRa41fslolH2iQV9Bwe5m0pclceE14UV0cEvO7CqavF cyberso@ip-172-26-3-119.eu-west-2.compute.internal
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCR0LGYoTUe8ZBhH1D9q/QxbmKzKLQS7TMEyPMCv3NidL+LHy60B5upmflIfIf7oRtyDXWGlH564CFQB8YDnXJBrUgCxpRWtT7MYLWMu9WA8OTtJnGi6r10maLp4RJi7yzuOZ36n+IW/ZdxxVgKgfVeUAtaYXZjrsOLepD4YfXjw4D0MYD7VPcYUdPjRf3m5vClaawvmMtNXh2d2a2BFDJCzX3YgAJdbNe9rJeVrigSWUahU6fPVKxbqEdb7E+l8YIUzNtnpjaxcaaBtLKbc4GiAzLmNOdG01F09/y3GTnHcZJSORLGowioZMpB+T8Q9pvW9lJDSw3k7GbUitpfMHT cloud
|
||||||
@@ -446,7 +446,7 @@ class preFlightsChecks:
|
|||||||
command = "sed -i 's|root|%s|g' %s" % (self.mysqluser, path)
|
command = "sed -i 's|root|%s|g' %s" % (self.mysqluser, path)
|
||||||
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||||
|
|
||||||
command = "sed -i 's|'PORT':''|'PORT':'%s'|g' %s" % (self.mysqlport, path)
|
command = "sed -i \"s|'PORT': ''|'PORT':'%s'|g\" %s" % (self.mysqlport, path)
|
||||||
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
|
||||||
|
|
||||||
logging.InstallLog.writeToFile("settings.py updated!")
|
logging.InstallLog.writeToFile("settings.py updated!")
|
||||||
|
|||||||
@@ -274,7 +274,6 @@ class InstallCyberPanel:
|
|||||||
|
|
||||||
def changeMYSQLRootPassword(self):
|
def changeMYSQLRootPassword(self):
|
||||||
if self.remotemysql == 'OFF':
|
if self.remotemysql == 'OFF':
|
||||||
|
|
||||||
if self.distro == ubuntu:
|
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:
|
else:
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ class mysqlUtilities:
|
|||||||
from json import loads
|
from json import loads
|
||||||
mysqlData = loads(open("/etc/cyberpanel/mysqlPassword", 'r').read())
|
mysqlData = loads(open("/etc/cyberpanel/mysqlPassword", 'r').read())
|
||||||
|
|
||||||
|
|
||||||
initCommand = 'mysql -h %s --port %s -u %s -p%s -e "' % (mysqlData['mysqlhost'], mysqlData['mysqlport'], mysqlData['mysqluser'], mysqlData['mysqlpassword'])
|
initCommand = 'mysql -h %s --port %s -u %s -p%s -e "' % (mysqlData['mysqlhost'], mysqlData['mysqlport'], mysqlData['mysqluser'], mysqlData['mysqlpassword'])
|
||||||
remote = 1
|
remote = 1
|
||||||
except:
|
except:
|
||||||
@@ -56,7 +55,26 @@ class mysqlUtilities:
|
|||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if remote:
|
if remote:
|
||||||
|
|
||||||
|
### DO Check
|
||||||
|
|
||||||
|
if mysqlData['mysqlhost'].find('ondigitalocean') > -1:
|
||||||
|
|
||||||
|
alterUserPassword = "ALTER USER 'cyberpanel'@'%s' IDENTIFIED WITH mysql_native_password BY '%s'" % (
|
||||||
|
publicip, dbpassword)
|
||||||
|
command = initCommand + alterUserPassword + '"'
|
||||||
|
|
||||||
|
if install.preFlightsChecks.debug:
|
||||||
|
print(command)
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
cmd = shlex.split(command)
|
||||||
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
## RDS Check
|
||||||
|
|
||||||
if mysqlData['mysqlhost'].find('rds.amazon') == -1:
|
if mysqlData['mysqlhost'].find('rds.amazon') == -1:
|
||||||
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip)
|
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import hashlib
|
|||||||
class ApplicationInstaller(multi.Thread):
|
class ApplicationInstaller(multi.Thread):
|
||||||
|
|
||||||
LOCALHOST = 'localhost'
|
LOCALHOST = 'localhost'
|
||||||
|
REMOTE = 0
|
||||||
|
PORT = '3306'
|
||||||
|
|
||||||
def __init__(self, installApp, extraArgs):
|
def __init__(self, installApp, extraArgs):
|
||||||
multi.Thread.__init__(self)
|
multi.Thread.__init__(self)
|
||||||
@@ -421,9 +423,10 @@ $parameters = array(
|
|||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
jsonData = json.loads(open(passFile, 'r').read())
|
jsonData = json.loads(open(passFile, 'r').read())
|
||||||
|
|
||||||
mysqlhost = jsonData['mysqlhost']
|
mysqlhost = jsonData['mysqlhost']
|
||||||
ApplicationInstaller.LOCALHOST = mysqlhost
|
ApplicationInstaller.LOCALHOST = mysqlhost
|
||||||
|
ApplicationInstaller.REMOTE = 1
|
||||||
|
ApplicationInstaller.PORT = jsonData['mysqlport']
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -582,7 +585,7 @@ $parameters = array(
|
|||||||
statusFile.writelines('Configuring the installation,40')
|
statusFile.writelines('Configuring the installation,40')
|
||||||
statusFile.close()
|
statusFile.close()
|
||||||
|
|
||||||
command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=%s --dbprefix=wp_ --allow-root --path=" % (ApplicationInstaller.LOCALHOST) + finalPath
|
command = "wp core config --dbname=" + dbName + " --dbuser=" + dbUser + " --dbpass=" + dbPassword + " --dbhost=%s:%s --dbprefix=wp_ --allow-root --path=" % (ApplicationInstaller.LOCALHOST, ApplicationInstaller.PORT) + finalPath
|
||||||
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
result = ProcessUtilities.outputExecutioner(command, externalApp)
|
||||||
|
|
||||||
if result.find('Success:') == -1:
|
if result.find('Success:') == -1:
|
||||||
@@ -1377,7 +1380,6 @@ $parameters = array(
|
|||||||
wm.submitWebsiteDeletion(1, self.extraArgs)
|
wm.submitWebsiteDeletion(1, self.extraArgs)
|
||||||
logging.statusWriter(self.extraArgs['tempStatusPath'], '%s [404].' % (str(msg)))
|
logging.statusWriter(self.extraArgs['tempStatusPath'], '%s [404].' % (str(msg)))
|
||||||
|
|
||||||
|
|
||||||
def installWhmcs(self):
|
def installWhmcs(self):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class mysqlUtilities:
|
|||||||
|
|
||||||
LOCALHOST = 'localhost'
|
LOCALHOST = 'localhost'
|
||||||
RDS = 0
|
RDS = 0
|
||||||
|
REMOTEHOST = ''
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getPagination(records, toShow):
|
def getPagination(records, toShow):
|
||||||
@@ -67,6 +68,7 @@ class mysqlUtilities:
|
|||||||
mysqlpassword = jsonData['mysqlpassword']
|
mysqlpassword = jsonData['mysqlpassword']
|
||||||
mysqlport = jsonData['mysqlport']
|
mysqlport = jsonData['mysqlport']
|
||||||
mysqlhost = jsonData['mysqlhost']
|
mysqlhost = jsonData['mysqlhost']
|
||||||
|
mysqlUtilities.REMOTEHOST = mysqlhost
|
||||||
|
|
||||||
if mysqlhost.find('rds.amazon') > -1:
|
if mysqlhost.find('rds.amazon') > -1:
|
||||||
mysqlUtilities.RDS = 1
|
mysqlUtilities.RDS = 1
|
||||||
@@ -114,7 +116,15 @@ class mysqlUtilities:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
cursor.execute("CREATE DATABASE " + dbname)
|
cursor.execute("CREATE DATABASE " + dbname)
|
||||||
cursor.execute("CREATE USER '" + dbuser + "'@'%s' IDENTIFIED BY '" % (mysqlUtilities.LOCALHOST) + dbpassword+ "'")
|
|
||||||
|
if mysqlUtilities.REMOTEHOST.find('ondigitalocean') > -1:
|
||||||
|
query = "CREATE USER '%s'@'%s' IDENTIFIED WITH mysql_native_password BY '%s'" % (
|
||||||
|
dbuser, mysqlUtilities.LOCALHOST, dbpassword)
|
||||||
|
else:
|
||||||
|
query = "CREATE USER '" + dbuser + "'@'%s' IDENTIFIED BY '" % (
|
||||||
|
mysqlUtilities.LOCALHOST) + dbpassword + "'"
|
||||||
|
|
||||||
|
cursor.execute(query)
|
||||||
|
|
||||||
if mysqlUtilities.RDS == 0:
|
if mysqlUtilities.RDS == 0:
|
||||||
cursor.execute("GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
cursor.execute("GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class StagingSetup(multi.Thread):
|
|||||||
|
|
||||||
dbNameRestore, dbUser, dbPassword = ApplicationInstaller(None, None).dbCreation(tempStatusPath, website)
|
dbNameRestore, dbUser, dbPassword = ApplicationInstaller(None, None).dbCreation(tempStatusPath, website)
|
||||||
|
|
||||||
command = 'wp core config --dbname=%s --dbuser=%s --dbpass=%s --path=%s' % (dbNameRestore, dbUser, dbPassword, path)
|
command = 'wp core config --dbname=%s --dbuser=%s --dbpass=%s --dbhost=%s:%s --path=%s' % (dbNameRestore, dbUser, dbPassword, ApplicationInstaller.LOCALHOST, ApplicationInstaller.PORT, path)
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
## Exporting and importing database
|
## Exporting and importing database
|
||||||
|
|||||||
Reference in New Issue
Block a user