Skip to content

Commit

Permalink
[system] Obfuscate proxy credentials in env. settings
Browse files Browse the repository at this point in the history
Obfuscate credentials in env.variable settings for e.g. HTTP_PROXY or
similar.

Inspired by: #3788
Resolves: #3789

Signed-off-by: Pavel Moravec <[email protected]>
  • Loading branch information
pmoravec committed Sep 25, 2024
1 parent a0035b6 commit ee3acd2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sos/report/plugins/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,20 @@ def setup(self):
"ld.so --list-tunables"
])

def postproc(self):

common_regex = r"(http(s)?://)\S+:\S+(@.*)"
common_replace = r"\1******:******\3"

files_to_sub = [
"/etc/sysconfig",
"/etc/default",
"/etc/environment",
]

for file in files_to_sub:
self.do_path_regex_sub(
file, common_regex, common_replace
)

# vim: set et ts=4 sw=4 :

0 comments on commit ee3acd2

Please sign in to comment.