aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2024-04-15 09:36:34 +0200
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-04-27 11:36:10 -0400
commit700c1a5801b70b9662ede8de40dacf2f85de1119 (patch)
tree7b5deea767c4336c6bdaa76a3d44c759a1047180
parent0ca16e7bd15af40c7ca53ce50c59adcb985e35c5 (diff)
downloadsos-700c1a5801b70b9662ede8de40dacf2f85de1119.tar.gz
[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 <pmoravec@redhat.com>
-rw-r--r--sos/report/plugins/ssh.py11
1 files 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: