diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-11-28 09:27:16 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-11-30 16:02:48 -0500 |
commit | 5e93dc2ce2c26c43d3e2f7e9a40cbf08507a5ea6 (patch) | |
tree | dd8f1cad6df0d45547111b9e46682975518c1a46 /base/deploy/src/scriptlets/pkilogging.py | |
parent | cef7a7704f9f4b48c0a9b242fabd3a919f2068d5 (diff) | |
download | pki-5e93dc2ce2c26c43d3e2f7e9a40cbf08507a5ea6.tar.gz pki-5e93dc2ce2c26c43d3e2f7e9a40cbf08507a5ea6.tar.xz pki-5e93dc2ce2c26c43d3e2f7e9a40cbf08507a5ea6.zip |
Reorganized sensitive parameters.
Previously sensitive parameters are stored in the Sensitive section in
the configuration file, separate from the hierarchical structure used
by non-sensitive parameters. To allow defining multiple subsystems in
a single configuration file the sensitive and non-sensitive parameters
have been reorganized into the same hierarchical structure.
To maintain the security a new meta-parameter has been added to list
all sensitive parameter names. This way the deployment code will know
whether a parameter is sensitive, which then will mask the value before
displaying it to the screen or storing it in a log file.
Ticket #399
Diffstat (limited to 'base/deploy/src/scriptlets/pkilogging.py')
-rw-r--r-- | base/deploy/src/scriptlets/pkilogging.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/deploy/src/scriptlets/pkilogging.py b/base/deploy/src/scriptlets/pkilogging.py index 9b22ae39c..3c146a12c 100644 --- a/base/deploy/src/scriptlets/pkilogging.py +++ b/base/deploy/src/scriptlets/pkilogging.py @@ -22,7 +22,25 @@ # System Imports import logging import os +import pprint +sensitive_parameters = [] + +# Initialize 'pretty print' for objects +pp = pprint.PrettyPrinter(indent=4) + +def format(dict): + new_dict = {} + + # mask sensitive data + for key in dict: + if key in sensitive_parameters: + value = 'XXXXXXXX' + else: + value = dict[key] + new_dict[key] = value + + return pp.pformat(new_dict) # PKI Deployment Logging Functions def enable_pki_logger(log_dir, log_name, log_level, console_log_level, logger): |