Skip to content

Commit

Permalink
[sunbeam_hypervisor] Fix obfuscation for ceilometer and hooks.log
Browse files Browse the repository at this point in the history
Previous environment tests did not have ceilometer, and testing on new
version brought out this issue.

Also solved the hooks.log obfuscation

Resolves: #3713

Co-authored-by: David Negreira <[email protected]>
Signed-off-by: Arif Ali <[email protected]>
Signed-off-by: David Negreira <[email protected]>
  • Loading branch information
2 people authored and TurboTurtle committed Jul 21, 2024
1 parent 524273a commit 052c431
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions sos/report/plugins/sunbeam_hypervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,33 @@ def postproc(self):
connection_keys = ["connection", "sql_connection"]

self.do_path_regex_sub(
fr"{self.common_dir}/etc/(nova|neutron)/*",
fr"{self.common_dir}/etc/(nova|neutron|ceilometer)/*",
fr'(^\s*({"|".join(protect_keys)})\s*=\s*)(.*)',
r"\1*********"
)
self.do_path_regex_sub(
fr"{self.common_dir}/etc/(nova|neutron)/*",
fr"{self.common_dir}/etc/(nova|neutron|ceilometer)/*",
fr'(^\s*({"|".join(connection_keys)})\s*=\s*(.*)'
r'://(\w*):)(.*)(@(.*))',
r"\1*********\6"
)

# hooks.log
protect_hook_keys = [
"password",
"ovn_metadata_proxy_shared_secret",
"cacert",
"cert",
"key",
"ovn_cacert",
"ovn_cert",
"ovn_key",
]

self.do_file_sub(
f'{self.common_dir}/hooks.log',
fr'(\'({"|".join(protect_hook_keys)})\'):\s?\'(.+?)\'',
r"\1: **********"
)

# vim: et ts=4 sw=4

0 comments on commit 052c431

Please sign in to comment.