From 700c1a5801b70b9662ede8de40dacf2f85de1119 Mon Sep 17 00:00:00 2001 From: Pavel Moravec Date: Mon, 15 Apr 2024 09:36:34 +0200 Subject: [ssh] Collect sshd_config.d directory Collect sshd config files in its dedicated sshd_config.d directory, as well as config files included from them. Resolves: #3595 Signed-off-by: Pavel Moravec --- sos/report/plugins/ssh.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sos/report/plugins/ssh.py b/sos/report/plugins/ssh.py index c44e813d..10a624cb 100644 --- a/sos/report/plugins/ssh.py +++ b/sos/report/plugins/ssh.py @@ -8,6 +8,7 @@ # # See the LICENSE file in the source distribution for further information. +from glob import glob from sos.report.plugins import Plugin, IndependentPlugin, PluginOpt @@ -33,7 +34,8 @@ class Ssh(Plugin, IndependentPlugin): sshcfgs = [ "/etc/ssh/ssh_config", - "/etc/ssh/sshd_config" + "/etc/ssh/sshd_config", + "/etc/ssh/sshd_config.d/*", ] # Include main config files @@ -49,7 +51,12 @@ class Ssh(Plugin, IndependentPlugin): """ Include subconfig files """ # Read configs for any includes and copy those try: - for sshcfg in sshcfgs: + cfgfiles = [ + f for files in [ + glob(copyspec, recursive=True) for copyspec in sshcfgs + ] for f in files + ] + for sshcfg in cfgfiles: tag = sshcfg.split('/')[-1] with open(self.path_join(sshcfg), 'r', encoding='UTF-8') as cfgfile: -- cgit