mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
bug fix: amazon rds
This commit is contained in:
@@ -57,7 +57,10 @@ class mysqlUtilities:
|
|||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
if remote:
|
if remote:
|
||||||
|
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:
|
||||||
|
dropDB = "GRANT SELECT, INSERT, DELETE ON " + dbname + ".* TO '" + dbuser + "'@'%s'" % (publicip)
|
||||||
else:
|
else:
|
||||||
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'localhost'"
|
dropDB = "GRANT ALL PRIVILEGES ON " + dbname + ".* TO '" + dbuser + "'@'localhost'"
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import argparse
|
|||||||
class mysqlUtilities:
|
class mysqlUtilities:
|
||||||
|
|
||||||
LOCALHOST = 'localhost'
|
LOCALHOST = 'localhost'
|
||||||
|
RDS = 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getPagination(records, toShow):
|
def getPagination(records, toShow):
|
||||||
@@ -67,6 +68,9 @@ class mysqlUtilities:
|
|||||||
mysqlport = jsonData['mysqlport']
|
mysqlport = jsonData['mysqlport']
|
||||||
mysqlhost = jsonData['mysqlhost']
|
mysqlhost = jsonData['mysqlhost']
|
||||||
|
|
||||||
|
if mysqlhost.find('rds.amazon') > -1:
|
||||||
|
mysqlUtilities.RDS = 1
|
||||||
|
|
||||||
## Also set localhost to this server
|
## Also set localhost to this server
|
||||||
|
|
||||||
ipFile = "/etc/cyberpanel/machineIP"
|
ipFile = "/etc/cyberpanel/machineIP"
|
||||||
@@ -148,7 +152,12 @@ class mysqlUtilities:
|
|||||||
if connection == 0:
|
if connection == 0:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if mysqlUtilities.RDS == 0:
|
||||||
cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
cursor.execute("GRANT ALL PRIVILEGES ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (mysqlUtilities.LOCALHOST))
|
||||||
|
else:
|
||||||
|
cursor.execute("GRANT SELECT, INSERT, DELETE ON " + dbName + ".* TO '" + globalUser + "'@'%s'" % (
|
||||||
|
mysqlUtilities.LOCALHOST))
|
||||||
|
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user