From af556b33b0e8c1e1d6ec69e67c79a96cecce1ffa Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Thu, 15 Feb 2024 13:57:15 +0000 Subject: [PATCH] [microk8s] Add obfuscation for client.config Resolves: SET-463 Signed-off-by: Arif Ali --- sos/report/plugins/microk8s.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sos/report/plugins/microk8s.py b/sos/report/plugins/microk8s.py index 52346ecc67..22a4f5f14e 100644 --- a/sos/report/plugins/microk8s.py +++ b/sos/report/plugins/microk8s.py @@ -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