Hide sensitive information from fm-manager logs

Checks for key, will not log to /var/log/fm-manager.log
if key is password or connection, these fields contain
sensitive information.

Partial-Bug: 1896116

Change-Id: Ide879ecf3b81133c26f20b0854e796998429f279
Signed-off-by: Lu Yao Chen <luyao.chen@windriver.com>
This commit is contained in:
Lu Yao Chen 2020-11-16 10:14:34 -05:00
parent 454aa61326
commit 0703f48452
2 changed files with 9 additions and 2 deletions

View File

@ -78,8 +78,13 @@ void fm_get_config_paramters() {
}
if (key.compare(FM_SQL_CONNECTION) != 0) {
// Don't log sql_connection, as it has a password
FM_INFO_LOG("Config key (%s), value (%s)",
key.c_str(), value.c_str());
if (key.compare(FM_CONF_PASSWORD) == 0 || key.compare(FM_CONF_CONNECTION) == 0) {
// Don't log password values
continue;
} else {
FM_INFO_LOG("Config key (%s), value (%s)",
key.c_str(), value.c_str());
}
}
}
}

View File

@ -92,6 +92,8 @@
#define FM_REGION_NAME "region_name"
#define FM_DEBUG_FLAG "debug"
#define FM_STRING_TRUE "True"
#define FM_CONF_PASSWORD "password"
#define FM_CONF_CONNECTION "connection"
#define CLEAR_ALL_REASON_TEXT "System initiated hierarchical alarm clear"