mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-01 04:09:03 +01:00
do check for remote db
This commit is contained in:
@@ -274,7 +274,6 @@ class InstallCyberPanel:
|
||||
|
||||
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)
|
||||
else:
|
||||
|
||||
@@ -14,7 +14,6 @@ class mysqlUtilities:
|
||||
from json import loads
|
||||
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'])
|
||||
remote = 1
|
||||
except:
|
||||
@@ -56,6 +55,19 @@ class mysqlUtilities:
|
||||
if res == 1:
|
||||
return 0
|
||||
else:
|
||||
### 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)
|
||||
|
||||
if remote:
|
||||
if mysqlData['mysqlhost'].find('rds.amazon') == -1:
|
||||
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip)
|
||||
|
||||
Reference in New Issue
Block a user