Update to 4.8.1 in RHEL 9

Resolves: RHEL-64159

Signed-off-by: Jan Jansky <jjansky@redhat.com>
This commit is contained in:
Jan Jansky 2024-10-23 11:25:29 +02:00
parent a36982bcd0
commit 95cc6655a3
6 changed files with 8 additions and 266 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ sos-2.2.tar.gz
/sos-4.7.1.tar.gz /sos-4.7.1.tar.gz
/sos-4.7.2.tar.gz /sos-4.7.2.tar.gz
/sos-4.8.0.tar.gz /sos-4.8.0.tar.gz
/sos-4.8.1.tar.gz

View File

@ -1,40 +0,0 @@
From c3b8bbcf7969999375d85c588c09d90d99ea41f3 Mon Sep 17 00:00:00 2001
From: Jose Castillo <jcastillo@redhat.com>
Date: Mon, 19 Aug 2024 11:37:08 +0100
Subject: [PATCH] [redhat] Fix return of function check_file_too_big()
Fix the return of the size checks for Red Hat uploads
to customer portal. Without this fix, uploads were failing
silently.
Signed-off-by: Jose Castillo <jcastillo@redhat.com>
---
sos/policies/distros/redhat.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py
index fb22c313..5b794fde 100644
--- a/sos/policies/distros/redhat.py
+++ b/sos/policies/distros/redhat.py
@@ -441,8 +441,7 @@ support representative.
f"{convert_bytes(self._max_size_request)} "
" via sos http upload. \n")
)
- return RH_SFTP_HOST
- return RH_API_HOST
+ self.upload_url = RH_SFTP_HOST
def upload_archive(self, archive):
"""Override the base upload_archive to provide for automatic failover
@@ -450,7 +449,7 @@ support representative.
"""
try:
if self.get_upload_url().startswith(RH_API_HOST):
- self.upload_url = self.check_file_too_big(archive)
+ self.check_file_too_big(archive)
uploaded = super().upload_archive(archive)
except Exception as e:
uploaded = False
--
2.46.0

View File

@ -1,71 +0,0 @@
From 3886534b707211c69e1f0ee8592ae9f9125227f2 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Mon, 26 Aug 2024 18:59:36 +0200
Subject: [PATCH] [report] Revert changed formatting of plugin+presets lists
During conversion to f-strings in #3606, some changes in UI output
happen. That makes some output less readable and could break some
automated tests anticipating given preset or plugin output strings.
This commit reverts back tto the original output, using f-strings.
Resolves: #3762
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/report/__init__.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sos/report/__init__.py b/sos/report/__init__.py
index 15974817..24294069 100644
--- a/sos/report/__init__.py
+++ b/sos/report/__init__.py
@@ -1029,7 +1029,7 @@ class SoSReport(SoSComponent):
self.ui_log.info(_("The following plugins are currently enabled:"))
self.ui_log.info("")
for (plugname, plug) in self.loaded_plugins:
- self.ui_log.info(f"{plugname:<20} {plug.get_description()}")
+ self.ui_log.info(f" {plugname:<20} {plug.get_description()}")
else:
self.ui_log.info(_("No plugin enabled."))
self.ui_log.info("")
@@ -1039,7 +1039,7 @@ class SoSReport(SoSComponent):
"disabled:"))
self.ui_log.info("")
for (plugname, plugclass, reason) in self.skipped_plugins:
- self.ui_log.info(f"{plugname:<20} {reason:<14} "
+ self.ui_log.info(f" {plugname:<20} {reason:<14} "
f"{plugclass.get_description()}")
self.ui_log.info("")
@@ -1060,7 +1060,7 @@ class SoSReport(SoSComponent):
val = TIMEOUT_DEFAULT
if opt.name == 'postproc':
val = not self.opts.no_postproc
- self.ui_log.info(f"{opt.name:<25} {val:<15} {opt.desc}")
+ self.ui_log.info(f" {opt.name:<25} {val:<15} {opt.desc}")
self.ui_log.info("")
self.ui_log.info(_("The following plugin options are available:"))
@@ -1126,14 +1126,14 @@ class SoSReport(SoSComponent):
if not preset:
continue
preset = self.policy.find_preset(preset)
- self.ui_log.info(f"name: {preset.name:>14}")
- self.ui_log.info(f"description: {preset.desc:>14}")
+ self.ui_log.info(f"{'name:':>14} {preset.name}")
+ self.ui_log.info(f"{'description:':>14} {preset.desc}")
if preset.note:
- self.ui_log.info(f"note: {preset.note:>14}")
+ self.ui_log.info(f"{'note:':>14} {preset.note}")
if self.opts.verbosity > 0:
args = preset.opts.to_args()
- options_str = f"{'options:':>14}"
+ options_str = f"{'options:':>14} "
lines = _format_list(options_str, args, indent=True, sep=' ')
for line in lines:
self.ui_log.info(line)
--
2.46.0

View File

@ -1,146 +0,0 @@
From 60356d6b1096407ed9cd71cf519ac2a381bedee4 Mon Sep 17 00:00:00 2001
From: Pavel Moravec <pmoravec@redhat.com>
Date: Fri, 27 Sep 2024 08:30:06 +0200
Subject: [PATCH 1/1] [plugins] Obfuscate http URL credentials
HTTP_PROXY or similar env.variables can contain credentials we must
scrub. The variables or directly credentials of a http(s) URL can be
specified in several places the commit deals with.
Futher, update apt plugin to use the new do_paths_httpp_sub method.
Resolves: #3789
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
---
sos/report/plugins/__init__.py | 15 +++++++++++++++
sos/report/plugins/anaconda.py | 9 +++++----
sos/report/plugins/apt.py | 12 ++----------
sos/report/plugins/system.py | 6 ++++++
sos/report/plugins/systemd.py | 7 +++++++
5 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index f88f0c0d..9b54c68a 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -1313,6 +1313,21 @@ class Plugin():
replacements = 0
return replacements
+ def do_paths_http_sub(self, pathspecs):
+ """ Obfuscate credentials in *_PROXY variables in all files in the
+ given list. Proxy setting without protocol is ignored, since that
+ is not recommended setting and obfuscating that one can hit false
+ positives.
+
+ :param pathspecs: A filepath to obfuscate credentials in
+ :type pathspecs: ``str`` or a ``list`` of strings
+ """
+ if isinstance(pathspecs, str):
+ pathspecs = [pathspecs]
+ for path in pathspecs:
+ self.do_path_regex_sub(
+ path, r"(http(s)?://)\S+:\S+(@.*)", r"\1******:******\3")
+
def do_path_regex_sub(self, pathexp, regexp, subst):
"""Apply a regexp substituation to a set of files archived by
sos. The set of files to be substituted is generated by matching
diff --git a/sos/report/plugins/anaconda.py b/sos/report/plugins/anaconda.py
index 78577d3f..77f54d65 100644
--- a/sos/report/plugins/anaconda.py
+++ b/sos/report/plugins/anaconda.py
@@ -24,21 +24,21 @@ class Anaconda(Plugin, RedHatPlugin):
def setup(self):
- paths = [
+ self.copypaths = [
"/root/anaconda-ks.cfg"
]
if self.path_isdir('/var/log/anaconda'):
# new anaconda
- paths.append('/var/log/anaconda')
+ self.copypaths.append('/var/log/anaconda')
else:
- paths = paths + [
+ self.copypaths = self.copypaths + [
"/var/log/anaconda.*",
"/root/install.log",
"/root/install.log.syslog"
]
- self.add_copy_spec(paths)
+ self.add_copy_spec(self.copypaths)
def postproc(self):
self.do_file_sub(
@@ -51,5 +51,6 @@ class Anaconda(Plugin, RedHatPlugin):
r"(user.*--password=*\s*)\s*(\S*)",
r"\1********"
)
+ self.do_paths_http_sub(self.copypaths)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/apt.py b/sos/report/plugins/apt.py
index 857a11b6..464cfb98 100644
--- a/sos/report/plugins/apt.py
+++ b/sos/report/plugins/apt.py
@@ -48,19 +48,11 @@ class Apt(Plugin, DebianPlugin, UbuntuPlugin):
def postproc(self):
super().postproc()
- common_regex = r"(http(s)?://)\S+:\S+(@.*)"
- common_replace = r"\1******:******\3"
-
- files_to_sub = [
+ self.do_paths_http_sub([
"/etc/apt/sources.list",
"/etc/apt/sources.list.d/",
"/etc/apt/apt.conf",
"/etc/apt/apt.conf.d/",
- ]
-
- for file in files_to_sub:
- self.do_path_regex_sub(
- file, common_regex, common_replace
- )
+ ])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/system.py b/sos/report/plugins/system.py
index cc282dc1..fcba1161 100644
--- a/sos/report/plugins/system.py
+++ b/sos/report/plugins/system.py
@@ -40,5 +40,11 @@ class System(Plugin, IndependentPlugin):
"ld.so --list-tunables"
])
+ def postproc(self):
+ self.do_paths_http_sub([
+ "/etc/sysconfig",
+ "/etc/default",
+ "/etc/environment",
+ ])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/systemd.py b/sos/report/plugins/systemd.py
index a50a155e..b23b32fe 100644
--- a/sos/report/plugins/systemd.py
+++ b/sos/report/plugins/systemd.py
@@ -95,4 +95,11 @@ class Systemd(Plugin, IndependentPlugin):
])
self.add_forbidden_path('/dev/null')
+ def postproc(self):
+ self.do_paths_http_sub([
+ "/etc/systemd/system",
+ "/lib/systemd/system",
+ "/run/systemd/system",
+ ])
+
# vim: set et ts=4 sw=4 :
--
2.43.5

View File

@ -4,8 +4,8 @@
Summary: A set of tools to gather troubleshooting information from a system Summary: A set of tools to gather troubleshooting information from a system
Name: sos Name: sos
Version: 4.8.0 Version: 4.8.1
Release: 5%{?dist} Release: 1%{?dist}
Group: Applications/System Group: Applications/System
Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz
Source1: sos-audit-%{auditversion}.tgz Source1: sos-audit-%{auditversion}.tgz
@ -22,9 +22,6 @@ Recommends: python3-pexpect
Recommends: python3-pyyaml Recommends: python3-pyyaml
Conflicts: vdsm < 4.40 Conflicts: vdsm < 4.40
Obsoletes: sos-collector <= 1.9 Obsoletes: sos-collector <= 1.9
Patch0: sos-Revert-changed-formatting.patch
Patch1: sos-RHEL-22732-Fix-check_file_too_big.patch
Patch2: sos-obfuscate-environment.patch
%description %description
Sos is a set of tools that gathers information about system Sos is a set of tools that gathers information about system
@ -35,9 +32,6 @@ support technicians and developers.
%prep %prep
%setup -qn %{name}-%{version} %setup -qn %{name}-%{version}
%setup -T -D -a1 -q %setup -T -D -a1 -q
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%build %build
%py3_build %py3_build
@ -110,6 +104,10 @@ of the system. Currently storage and filesystem commands are audited.
%changelog %changelog
* Wed Oct 23 2024 Jan Jansky <jjansky@redhat.com> = 4.8.1-1
- Update to 4.8.1 in RHEL 9
Resolves: RHEL-64159
* Tue Oct 15 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-5 * Tue Oct 15 2024 Jan Jansky <jjansky@redhat.com> = 4.8.0-5
- Rebase to 4.8.0 and adding credential obfuscation - Rebase to 4.8.0 and adding credential obfuscation
Resolves: RHEL-58096 Resolves: RHEL-58096

View File

@ -1,2 +1,2 @@
SHA512 (sos-4.8.0.tar.gz) = d0874794d015e07cbd57ddf7f6092c8f61b8fb866abc34073c1c865353acdb1df37290aa99431e41f6c863fe6b04c16488c6ee748aba55ec81d90efd8543ad92 SHA512 (sos-4.8.1.tar.gz) = c75d5a891c0dd48d2cf511f39dc25a71b65e9daf965d9c1be7ace94f957ec62543fa0c8d1cc700b557920ee581eacce9cf1d8520d5401396aba323dee131e633
SHA512 (sos-audit-0.3.tgz) = 32597baf6350804d08179a0dbe48470a93df148e83d2e49bb3288f6bcc2d151bb1433761913bfbccd912c14de92435939fef5bcd7e091dfe33a345d61ea842ea SHA512 (sos-audit-0.3.tgz) = 32597baf6350804d08179a0dbe48470a93df148e83d2e49bb3288f6bcc2d151bb1433761913bfbccd912c14de92435939fef5bcd7e091dfe33a345d61ea842ea