Skip to content

Commit

Permalink
[microk8s] Add obfuscation for client.config
Browse files Browse the repository at this point in the history
Resolves: SET-463
Signed-off-by: Arif Ali <[email protected]>
  • Loading branch information
arif-ali authored and TurboTurtle committed Feb 15, 2024
1 parent edad5b5 commit af556b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sos/report/plugins/microk8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,17 @@ def postproc(self):
rsub = r'(certificate-authority-data:|token:)\s.*'
self.do_cmd_output_sub("microk8s", rsub, r'\1 "**********"')

protect_keys = [
"certificate-authority-data",
"client-certificate-data",
"client-key-data",
]

key_regex = fr'(^\s*({"|".join(protect_keys)})\s*:\s*)(.*)'

self.do_path_regex_sub(
"/var/snap/microk8s/current/credentials/client.config",
key_regex, r"\1*********"
)

# vim: set et ts=4 sw=4

0 comments on commit af556b3

Please sign in to comment.