aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArif Ali <arif.ali@canonical.com>2024-02-15 13:57:15 +0000
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-02-15 10:31:57 -0500
commitaf556b33b0e8c1e1d6ec69e67c79a96cecce1ffa (patch)
tree20033329500cf2ee5877986e32021ccf864ef0ec
parentedad5b586c7d2d5cc4464c6662ca4211a8d81da8 (diff)
downloadsos-af556b33b0e8c1e1d6ec69e67c79a96cecce1ffa.tar.gz
[microk8s] Add obfuscation for client.config
Resolves: SET-463 Signed-off-by: Arif Ali <arif.ali@canonical.com>
-rw-r--r--sos/report/plugins/microk8s.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/sos/report/plugins/microk8s.py b/sos/report/plugins/microk8s.py
index 52346ecc..22a4f5f1 100644
--- a/sos/report/plugins/microk8s.py
+++ b/sos/report/plugins/microk8s.py
@@ -52,4 +52,17 @@ class Microk8s(Plugin, UbuntuPlugin):
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