diff options
author | Rohan Arora <roarora@redhat.com> | 2019-12-05 12:52:39 +0530 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-01-08 12:54:52 -0500 |
commit | e1e1d9cfc846c969884fc68a1a5dc493bb732653 (patch) | |
tree | 4591d3827503911aa144fbd9d9382e4f90efcc48 | |
parent | dd5d421aa02eb50ad345a9218d09e1e442dbabff (diff) | |
download | sos-e1e1d9cfc846c969884fc68a1a5dc493bb732653.tar.gz |
[foreman] Fix invalid yaml files
Foreman plugin replaces sensitive data with ***** which is not a yalid
yaml value. Hence the yaml files collected by sos are not valid yaml
files. This change replaces the sensitive data with quoted stars
"*****" instead to presrve yaml syntax.
Closes #1876
Resolves: #1877
Signed-off-by: Rohan Arora <roarora@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/plugins/foreman.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py index 3e500e5b..1d02777f 100644 --- a/sos/plugins/foreman.py +++ b/sos/plugins/foreman.py @@ -259,8 +259,13 @@ class Foreman(Plugin): "/var/log/foreman-installer/foreman-proxy*", r"(\s*proxy_password\s=) (.*)", r"\1 ********") + # yaml values should be alphanumeric self.do_path_regex_sub( - "/etc/foreman(.*)((yaml|yml|conf)(.*)?)", + "/etc/foreman(.*)((yaml|yml)(.*)?)", + r"((\:|\s*)(passw|cred|token|secret|key).*(\:\s|=))(.*)", + r'\1"********"') + self.do_path_regex_sub( + "/etc/foreman(.*)((conf)(.*)?)", r"((\:|\s*)(passw|cred|token|secret|key).*(\:\s|=))(.*)", r"\1********") self.do_path_regex_sub( |