Blob Blame History Raw
From 0b81b7ef780171af4431db656809f10d1683bc4c Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Tue, 20 Sep 2022 22:11:48 +0200
Subject: [PATCH 1/2] [dnf] Collect legacy yum config and dnf global vars

Some systems might rely on legacy yum config with default symlinks to
dnf config - sos should collect the symlinks.

Additionally, collect dnf global vars.

Related: #3031

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
 sos/report/plugins/dnf.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index 59b8de6c..82078faf 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -55,7 +55,12 @@ class DNFPlugin(Plugin, RedHatPlugin):
             '/etc/dnf/modules.d/.*.module': 'dnf_modules'
         })
 
-        self.add_copy_spec("/etc/dnf/")
+        self.add_copy_spec([
+            "/etc/dnf/",
+            "/etc/yum.conf",
+            "/etc/yum/pluginconf.d/",
+            "/etc/yum/vars/",
+        ])
         self.add_copy_spec("/etc/yum.repos.d/",
                            tags=['yum_repos_d', 'dnf_repos_d', 'dnf_repo'])
 
-- 
2.37.3


From ff17d6486f349dcdc115e898cc50c3845578aef3 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Tue, 20 Sep 2022 22:20:51 +0200
Subject: [PATCH 2/2] [dnf] Obfuscate all passwords from all vars

- obfuscate also "password=.." variable values
- apply the obfuscation also to global vars dir

Resolves: #3031

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
 sos/report/plugins/dnf.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index 82078faf..6efc9cac 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -125,8 +125,9 @@ class DNFPlugin(Plugin, RedHatPlugin):
         self.get_modules_info(modules['output'])
 
     def postproc(self):
-        regexp = r"(proxy_password(\s)*=(\s)*)(\S+)\n"
+        regexp = r"(password(\s)*=(\s)*)(\S+)\n"
         repl = r"\1********\n"
-        self.do_path_regex_sub("/etc/yum.repos.d/*", regexp, repl)
+        for f in ["/etc/yum.repos.d/*", "/etc/dnf/vars/*"]:
+            self.do_path_regex_sub(f, regexp, repl)
 
 # vim: set et ts=4 sw=4 :
-- 
2.37.3