Skip to content

Commit

Permalink
[ssh] Add User .ssh Config File Option
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Daniel Zhou authored and dtzhou2 committed Jul 7, 2023
1 parent fc1489a commit 32537bb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sos/report/plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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({
Expand All @@ -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
Expand Down

0 comments on commit 32537bb

Please sign in to comment.