Skip to content

Commit 5e7a01d

Browse files
archanaserverpmoravec
authored andcommitted
[foremanctl] Enable plugin for containerized deployments
The plugin required foremanctl package which doesn't exist in containerized mode. Add container detection to enable the plugin and collect foremanctl health diagnostics for support cases. Signed-off-by: akumari <akumari@redhat.com>
1 parent a5a5ada commit 5e7a01d

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

sos/report/plugins/foremanctl.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Foremanctl(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
1919
plugin_name = 'foremanctl'
2020
profiles = ('sysmgmt',)
2121
packages = ('foremanctl', )
22+
containers = ('foreman', 'foreman-proxy',)
2223

2324
def setup(self):
2425
self.add_copy_spec([
@@ -29,14 +30,34 @@ def setup(self):
2930

3031
self.add_cmd_output([
3132
"foremanctl features",
33+
"foremanctl health",
3234
])
3335

3436
self.add_dir_listing(["/var/lib/foremanctl/"], recursive=True)
3537

3638
def postproc(self):
37-
self.do_path_regex_sub("/var/lib/foremanctl/parameters.yaml",
38-
r"(foreman_initial_admin_password:\s*)(.*)",
39-
r"\1********")
40-
39+
# Scrub passwords, credentials, tokens, secrets, and keys
40+
self.do_path_regex_sub(
41+
"/var/lib/foremanctl/parameters.yaml",
42+
r"((.*)?(passw|cred|token|secret|key).*(\:\s|=))(.*)",
43+
r"\1********")
44+
45+
# Scrub passwords from foremanctl logs - Pattern 1: key=value format
46+
self.do_path_regex_sub(
47+
"/var/log/foremanctl/foremanctl.*log*",
48+
r"((passw|cred|token|secret|key)\w*\s*=\s*)(.*?)(\s|,|\"|'|$)",
49+
r"\1********\4")
50+
51+
# Scrub passwords from foremanctl logs - Pattern 2: "password something" format
52+
self.do_path_regex_sub(
53+
"/var/log/foremanctl/foremanctl.*log*",
54+
r"(password\s+)(.*?)(\s|,|\"|$)",
55+
r"\1********\3")
56+
57+
# Scrub admin credentials in username:password format
58+
self.do_path_regex_sub(
59+
"/var/log/foremanctl/foremanctl.*log*",
60+
r"(Admin credentials:\s+\w+:)(.*?)(\"|,|$)",
61+
r"\1********\3")
4162

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

0 commit comments

Comments
 (0)