Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[foreman] Obfuscate http_proxy passwords #3878

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sos/report/plugins/foreman.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,23 @@ def postproc(self):
r"/etc/foreman/(.*)((yaml|yml)(.*)?)",
r"((\:|\s*)(passw|cred|token|secret|key).*(\:\s|=))(.*)",
r'\1"********"')
# hide proxy credentials..
self.do_paths_http_sub([
'/var/log/foreman/production.log*',
])
# .. even those appearing TWICE in the logfile, in format (one-line):
# Setting (7) update event on value --- https://USER:PASS@foobar:443,\
# --- https://USER:PASS@foobar:3128
self.do_path_regex_sub(
'/var/log/foreman/production.log*',
r", --- (http(s)?://)\S+:\S+(@.*)",
r"\1******:******\3"
)
# hide proxy credentials from http_proxy setting
self.do_cmd_output_sub(
"from settings where",
r"(http(s)?://)\S+:\S+(@.*)",
r"\1******:******\3")

# Let the base Foreman class handle the string substitution of the apachepkg
# attr so we can keep all log definitions centralized in the main class
Expand Down
Loading