From 32537bb570865208000052048475fd67ba1de3be Mon Sep 17 00:00:00 2001 From: Daniel Zhou Date: Mon, 3 Jul 2023 11:00:25 -0400 Subject: [PATCH] [ssh] Add User .ssh Config File Option Resolves issue SUPDEV-137. Adds a plugin option for the ssh module, defining whether it will or will not collect .ssh config files per user Default for new option is True Signed-off-by: Daniel Zhou --- sos/report/plugins/ssh.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sos/report/plugins/ssh.py b/sos/report/plugins/ssh.py index 0fe5dd4e2d..67a022902c 100644 --- a/sos/report/plugins/ssh.py +++ b/sos/report/plugins/ssh.py @@ -8,7 +8,7 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt class Ssh(Plugin, IndependentPlugin): @@ -18,6 +18,12 @@ class Ssh(Plugin, IndependentPlugin): plugin_name = 'ssh' profiles = ('services', 'security', 'system', 'identity') + option_list = [ + PluginOpt('userconfs', default=True, val_type=str, + desc=('Changes whether module will ' + 'collect user .ssh configs')) + ] + def setup(self): self.add_file_tags({ @@ -34,7 +40,10 @@ def setup(self): self.add_copy_spec(sshcfgs) self.included_configs(sshcfgs) - self.user_ssh_files_permissions() + + # If userconfs option is set to False, skips this + if self.get_option('userconfs'): + self.user_ssh_files_permissions() def included_configs(self, sshcfgs): # Read configs for any includes and copy those