From f3fb93fbe08a02c90b00893c2f21d418ce07399e Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Sat, 29 Aug 2020 19:36:01 +0500 Subject: [PATCH] replace localhost with remote mysql in case of rds --- install/install.py | 5 +++++ plogical/mysqlUtilities.py | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/install/install.py b/install/install.py index 45db696e5..6fa4b9b12 100755 --- a/install/install.py +++ b/install/install.py @@ -723,6 +723,11 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout'; command = 'cp /usr/local/CyberCP/plogical/phpmyadminsignin.php /usr/local/CyberCP/public/phpmyadmin/phpmyadminsignin.php' preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + if self.remotemysql == 'ON': + command = "sed -i 's|localhost|%s|g' /usr/local/CyberCP/public/phpmyadmin/phpmyadminsignin.php" % (self.mysqlhost) + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + except BaseException as msg: logging.InstallLog.writeToFile('[ERROR] ' + str(msg) + " [download_install_phpmyadmin]") return 0 diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index df9e90c5e..2fc0da657 100755 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -929,8 +929,13 @@ skip-name-resolve cursor.execute( "CREATE USER '" + user + "'@'%s' IDENTIFIED BY '" % (mysqlUtilities.LOCALHOST) + password + "'") - cursor.execute( - "GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + if mysqlUtilities.RDS == 0: + cursor.execute( + "GRANT ALL PRIVILEGES ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + else: + cursor.execute( + "GRANT INDEX, DROP, UPDATE, ALTER, CREATE, SELECT, INSERT, DELETE ON " + database + ".* TO '" + user + "'@'%s'" % (mysqlUtilities.LOCALHOST)) + connection.close() return 1