Skip to content

Commit 057d1f9

Browse files
committed
restricted passwords from logging
1 parent c630c0d commit 057d1f9

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

ee/cli/plugins/site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ def default(self):
475475

476476
if data['wp']:
477477
Log.info(self, Log.ENDC + "WordPress admin user :"
478-
" {0}".format(ee_wp_creds['wp_user']))
478+
" {0}".format(ee_wp_creds['wp_user']), log=False)
479479
Log.info(self, Log.ENDC + "WordPress admin user password : {0}"
480-
.format(ee_wp_creds['wp_pass']))
480+
.format(ee_wp_creds['wp_pass']), log=False)
481481

482482
display_cache_settings(self, data)
483483
addNewSite(self, ee_www_domain, stype, cache, ee_site_webroot)

ee/cli/plugins/site_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ def setupdatabase(self, data):
117117

118118
# Create MySQL User
119119
Log.debug(self, "Creating user {0}".format(ee_db_username))
120+
Log.debug(self, "create user {0}@{1} identified by ''"
121+
.format(ee_db_username, ee_mysql_grant_host))
120122
EEMysql.execute(self,
121123
"create user {0}@{1} identified by '{2}'"
122124
.format(ee_db_username, ee_mysql_grant_host,
123125
ee_db_password),
124-
errormsg="Cannot setup database user")
126+
errormsg="Cannot setup database user", log=False)
125127

126128
# Grant permission
127129
Log.debug(self, "Setting up user privileges")

ee/core/logging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def error(self, msg):
2323
self.app.log.error(Log.FAIL + msg + Log.ENDC)
2424
self.app.close(1)
2525

26-
def info(self, msg, end='\n'):
26+
def info(self, msg, end='\n', log=True):
2727
"""
2828
Logs info messages into log file
2929
"""
30+
3031
print(Log.OKBLUE + msg + Log.ENDC, end=end)
31-
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)
32+
if log:
33+
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)
3234

3335
def warn(self, msg):
3436
"""

ee/core/mysql.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class EEMysql():
1010
"""Method for MySQL connection"""
1111

12-
def execute(self, statement, errormsg=''):
12+
def execute(self, statement, errormsg='', log=True):
1313
"""Get login details from ~/.my.cnf & Execute MySQL query"""
1414
config = configparser.RawConfigParser()
1515
cnfpath = expanduser("~")+"/.my.cnf"
@@ -43,7 +43,10 @@ def execute(self, statement, errormsg=''):
4343
.format(e))
4444

4545
try:
46-
Log.debug(self, "Executing MySQL statement: {0}".format(statement))
46+
if log:
47+
Log.debug(self, "Executing MySQL statement: {0}"
48+
.format(statement))
49+
4750
cur.execute(statement)
4851
except Exception as e:
4952
cur.close()

0 commit comments

Comments
 (0)