From c574d440c168a9f48ffb94e3ecdc162e1e263d47 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 24 Jun 2025 16:59:03 +0000 Subject: [PATCH] import UBI sos-4.9.1-2.el10_0 --- .gitignore | 4 +- ...L-75977-new-plugin-aap_containerized.patch | 143 ------------------ ...er-Use-hostname-f-in-HostnamePrepper.patch | 37 +++++ ...f-Scrub-passwords-in-repository-URIs.patch | 30 ++++ ...gic-to-request-case-id-if-not-presen.patch | 111 ++++++++++++++ sos.spec | 25 ++- sources | 4 +- 7 files changed, 201 insertions(+), 153 deletions(-) delete mode 100644 sos-RHEL-75977-new-plugin-aap_containerized.patch create mode 100644 sos-cleaner-Use-hostname-f-in-HostnamePrepper.patch create mode 100644 sos-dnf-Scrub-passwords-in-repository-URIs.patch create mode 100644 sos-policy-Re-add-logic-to-request-case-id-if-not-presen.patch diff --git a/.gitignore b/.gitignore index 8367a3f..dbb690a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -sos-4.8.2.tar.gz -sos-audit-0.3.tgz +sos-4.9.1.tar.gz +sos-audit-0.3-1.tgz diff --git a/sos-RHEL-75977-new-plugin-aap_containerized.patch b/sos-RHEL-75977-new-plugin-aap_containerized.patch deleted file mode 100644 index 23e6ff7..0000000 --- a/sos-RHEL-75977-new-plugin-aap_containerized.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 8fb859dea4366ac446fab1855ce3a163e6312d25 Mon Sep 17 00:00:00 2001 -From: Nagoor Shaik -Date: Thu, 2 Jan 2025 10:05:24 +0530 -Subject: [PATCH] added new AAP Containerized plugin - -Signed-off-by: Nagoor Shaik ---- - sos/report/plugins/aap_containerized.py | 123 ++++++++++++++++++++++++ - 1 file changed, 123 insertions(+) - create mode 100644 sos/report/plugins/aap_containerized.py - -diff --git a/sos/report/plugins/aap_containerized.py b/sos/report/plugins/aap_containerized.py -new file mode 100644 -index 00000000..543104d3 ---- /dev/null -+++ b/sos/report/plugins/aap_containerized.py -@@ -0,0 +1,123 @@ -+# Copyright (c) 2025 Nagoor Shaik -+ -+# This file is part of the sos project: https://github.com/sosreport/sos -+# -+# This copyrighted material is made available to anyone wishing to use, -+# modify, copy, or redistribute it subject to the terms and conditions of -+# version 2 of the GNU General Public License. -+# -+# See the LICENSE file in the source distribution for further information. -+ -+import os -+from sos.report.plugins import Plugin, RedHatPlugin, PluginOpt -+ -+ -+class AAPContainerized(Plugin, RedHatPlugin): -+ """Collects details about AAP Containerized setup -+ under a user's home directory""" -+ -+ short_desc = "AAP Containerized Setup" -+ plugin_name = "aap_containerized" -+ profiles = ("sysmgmt", "ansible",) -+ packages = ("podman",) -+ -+ option_list = [ -+ PluginOpt( -+ "username", -+ default="", -+ val_type=str, -+ desc="Username that was used to setup " -+ "AAP containerized installation" -+ ), -+ PluginOpt( -+ "directory", -+ default="", -+ val_type=str, -+ desc="Absolute path to AAP containers volume directory. " -+ "Defaults to 'aap' under provided user's home directory" -+ ) -+ ] -+ -+ def setup(self): -+ # Check if username is passed as argument -+ username = self.get_option("username") -+ if not username: -+ self._log_error("Username is mandatory to collect " -+ "AAP containerized setup logs") -+ return -+ -+ # Grab aap installation directory under user's home -+ if not self.get_option("directory"): -+ user_home_directory = os.path.expanduser(f"~{username}") -+ aap_directory_name = self.path_join(user_home_directory, "aap") -+ else: -+ aap_directory_name = self.get_option("directory") -+ -+ # Don't collect cert and key files from the installation directory -+ if self.path_exists(aap_directory_name): -+ forbidden_paths = [ -+ self.path_join(aap_directory_name, path) -+ for path in [ -+ "containers", -+ "tls", -+ "controller/etc/*.cert", -+ "controller/etc/*.key", -+ "eda/etc/*.cert", -+ "eda/etc/*.key", -+ "gateway/etc/*.cert", -+ "gateway/etc/*.key", -+ "hub/etc/*.cert", -+ "hub/etc/*.key", -+ "hub/etc/keys/*.pem", -+ "postgresql/*.crt", -+ "postgresql/*.key", -+ "receptor/etc/*.crt", -+ "receptor/etc/*.key", -+ "receptor/etc/*.pem", -+ "redis/*.crt", -+ "redis/*.key", -+ ] -+ ] -+ self.add_forbidden_path(forbidden_paths) -+ self.add_copy_spec(aap_directory_name) -+ else: -+ self._log_error(f"Directory {aap_directory_name} does not exist " -+ "or invalid absolute path provided") -+ -+ # Gather output of following podman commands as user -+ podman_commands = [ -+ (f"su - {username} -c 'podman info --debug'", "podman_info"), -+ (f"su - {username} -c 'podman ps -a --format json'", -+ "podman_ps_all_json"), -+ ] -+ -+ for command, filename in podman_commands: -+ self.add_cmd_output(command, suggest_filename=filename) -+ -+ # Collect AAP container names -+ aap_containers = self._get_aap_container_names(username) -+ -+ # Copy podman container log files in plugin sub directory -+ # under aap_containers_log -+ for container in aap_containers: -+ log_file = f"{container}.log" -+ self.add_cmd_output( -+ f"su - {username} -c 'podman logs {container}'", -+ suggest_filename=f"{log_file}", -+ subdir="aap_containers_log" -+ ) -+ -+ # Function to fetch podman container names -+ def _get_aap_container_names(self, username): -+ try: -+ cmd = f"su - {username} -c 'podman ps -a --format {{{{.Names}}}}'" -+ cmd_out = self.exec_cmd(cmd) -+ return cmd_out['output'].strip().split("\n") -+ except Exception: -+ self._log_error("Error retrieving Podman containers") -+ return [] -+ -+ # Check and enable plugin on a AAP Containerized host -+ def check_enabled(self): -+ ps = self.exec_cmd("ps --noheaders axco command") -+ return "awx-manage" in ps["output"] and "aap-gateway" in ps["output"] --- -2.47.1 - diff --git a/sos-cleaner-Use-hostname-f-in-HostnamePrepper.patch b/sos-cleaner-Use-hostname-f-in-HostnamePrepper.patch new file mode 100644 index 0000000..4dad30f --- /dev/null +++ b/sos-cleaner-Use-hostname-f-in-HostnamePrepper.patch @@ -0,0 +1,37 @@ +From 1d449044caf2224da5e55d0de51459137feb0807 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Sun, 25 May 2025 11:46:34 +0200 +Subject: [PATCH] [cleaner] Use "hostname -f" in HostnamePrepper + +HostnamePrepper should always be fed by FQDN to ensure domain names are +recognized properly. + +This is important esp. when: +- /etc/hosts is empty +- "hostname" contains shortname only +- "hostname -f" contains FQDN + +Resolves: #4022 +Closes: #4026 + +Signed-off-by: Pavel Moravec +--- + sos/cleaner/preppers/hostname.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sos/cleaner/preppers/hostname.py b/sos/cleaner/preppers/hostname.py +index 0812597e..b20f5679 100644 +--- a/sos/cleaner/preppers/hostname.py ++++ b/sos/cleaner/preppers/hostname.py +@@ -29,7 +29,7 @@ class HostnamePrepper(SoSPrepper): + items = [] + _file = 'hostname' + if archive.is_sos: +- _file = 'sos_commands/host/hostname' ++ _file = 'sos_commands/host/hostname_-f' + elif archive.is_insights: + _file = 'data/insights_commands/hostname_-f' + +-- +2.49.0 + diff --git a/sos-dnf-Scrub-passwords-in-repository-URIs.patch b/sos-dnf-Scrub-passwords-in-repository-URIs.patch new file mode 100644 index 0000000..6551572 --- /dev/null +++ b/sos-dnf-Scrub-passwords-in-repository-URIs.patch @@ -0,0 +1,30 @@ +From c41fca3daed8b515c4022ab02232acab8b1ec4c4 Mon Sep 17 00:00:00 2001 +From: Pavel Moravec +Date: Tue, 20 May 2025 13:18:26 +0200 +Subject: [PATCH] [dnf] Scrub passwords in repository URIs + +Closes: #4018 + +Signed-off-by: Pavel Moravec +--- + sos/report/plugins/dnf.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py +index 4a1e52b9..69224955 100644 +--- a/sos/report/plugins/dnf.py ++++ b/sos/report/plugins/dnf.py +@@ -150,4 +150,10 @@ class DNFPlugin(Plugin, RedHatPlugin): + # + self.do_file_sub("/etc/dnf/dnf.conf", regexp, repl) + ++ # Scrub credentials in http URIs ++ self.do_paths_http_sub([ ++ '/etc/yum.repos.d/*', ++ '/var/log/dnf.*', ++ ]) ++ + # vim: set et ts=4 sw=4 : +-- +2.49.0 + diff --git a/sos-policy-Re-add-logic-to-request-case-id-if-not-presen.patch b/sos-policy-Re-add-logic-to-request-case-id-if-not-presen.patch new file mode 100644 index 0000000..228e89f --- /dev/null +++ b/sos-policy-Re-add-logic-to-request-case-id-if-not-presen.patch @@ -0,0 +1,111 @@ +From 369e65acafa70a6d7a9751802395bddaaeafd141 Mon Sep 17 00:00:00 2001 +From: Jose Castillo +Date: Wed, 21 May 2025 10:10:41 +0100 +Subject: [PATCH] [policy] Re-add logic to request case-id if not present + +This commit re-adds the logic to ask for case-id if +the user hasn't specified it in the command line +explicitly. + +Related: RHEL-92071 + +Signed-off-by: Jose Castillo +--- + sos/policies/distros/__init__.py | 18 ++++++++++++++++-- + sos/upload/__init__.py | 3 +++ + sos/upload/targets/redhat.py | 22 ++-------------------- + 3 files changed, 21 insertions(+), 22 deletions(-) + +diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py +index 06327a6b..7004fdbd 100644 +--- a/sos/policies/distros/__init__.py ++++ b/sos/policies/distros/__init__.py +@@ -13,6 +13,7 @@ + import os + import re + ++from sos import _sos as _ + from sos.policies import Policy + from sos.policies.init_systems import InitSystem + from sos.policies.init_systems.systemd import SystemdInit +@@ -300,8 +301,21 @@ class LinuxPolicy(Policy): + if cmdline_opts.low_priority: + self._configure_low_priority() + +- if cmdline_opts.case_id: +- self.case_id = cmdline_opts.case_id ++ # set or query for case id ++ self.case_id = self.prompt_for_case_id(cmdline_opts) ++ ++ def prompt_for_case_id(self, cmdline_opts): ++ if not cmdline_opts.batch and not \ ++ cmdline_opts.quiet: ++ if not cmdline_opts.case_id: ++ cmdline_opts.case_id = input( ++ _("Optionally, please enter the case id that you are " ++ "generating this report for: ") ++ ) ++ self.case_id = cmdline_opts.case_id if \ ++ cmdline_opts.case_id else "" ++ ++ return self.case_id + + def _configure_low_priority(self): + """Used to constrain sos to a 'low priority' execution, potentially +diff --git a/sos/upload/__init__.py b/sos/upload/__init__.py +index 97872f69..7be33f65 100644 +--- a/sos/upload/__init__.py ++++ b/sos/upload/__init__.py +@@ -282,6 +282,9 @@ this utility. + if self.from_cmdline: + self.intro() + self.archive = self.opts.upload_file ++ self.caseid = self.policy.prompt_for_case_id( ++ cmdline_opts=self.opts ++ ) + cmdline_target = self.opts.upload_target + if cmdline_target and cmdline_target != 'local': + self.upload_target = self.upload_targets[cmdline_target] +diff --git a/sos/upload/targets/redhat.py b/sos/upload/targets/redhat.py +index b3e8e3c5..d5262af0 100644 +--- a/sos/upload/targets/redhat.py ++++ b/sos/upload/targets/redhat.py +@@ -52,25 +52,6 @@ class RHELUploadTarget(UploadTarget): + + self.upload_directory = self.commons['cmdlineopts'].upload_directory + +- def prompt_for_case_id(self): +- caseid = self.commons['cmdlineopts'].case_id if \ +- self.commons['cmdlineopts'].case_id else "" +- +- # set or query for case id +- if not self.commons['cmdlineopts'].batch and not \ +- self.commons['cmdlineopts'].quiet: +- if caseid: +- self.commons['cmdlineopts'].case_id = caseid +- else: +- self.commons['cmdlineopts'].case_id = input( +- _("Optionally, please enter the case id that you are " +- "generating this report for: ") +- ) +- if self.commons['cmdlineopts'].case_id: +- self.case_id = self.commons['cmdlineopts'].case_id +- +- return self.case_id +- + def prompt_for_upload_user(self): + if self.commons['cmdlineopts'].upload_user: + self.ui_log.info( +@@ -101,7 +82,8 @@ class RHELUploadTarget(UploadTarget): + if self.commons['cmdlineopts'].upload_protocol == 'sftp': + return self.RH_SFTP_HOST + if not self.commons['cmdlineopts'].case_id and not\ +- self.prompt_for_case_id(): ++ self.commons['policy'].prompt_for_case_id( ++ self.commons['cmdlineopts']): + return self.RH_SFTP_HOST + + except Exception as e: +-- +2.49.0 + diff --git a/sos.spec b/sos.spec index 6428578..2c2c582 100644 --- a/sos.spec +++ b/sos.spec @@ -1,10 +1,10 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%global auditversion 0.3 +%global auditversion 0.3-1 Summary: A set of tools to gather troubleshooting information from a system Name: sos -Version: 4.8.2 +Version: 4.9.1 Release: 2%{?dist} Group: Applications/System Source0: https://github.com/sosreport/sos/archive/%{version}/sos-%{version}.tar.gz @@ -22,7 +22,9 @@ Recommends: python3-pexpect Recommends: python3-pyyaml Conflicts: vdsm < 4.40 Obsoletes: sos-collector <= 1.9 -Patch1: sos-RHEL-75977-new-plugin-aap_containerized.patch +Patch1: sos-cleaner-Use-hostname-f-in-HostnamePrepper.patch +Patch2: sos-dnf-Scrub-passwords-in-repository-URIs.patch +Patch3: sos-policy-Re-add-logic-to-request-case-id-if-not-presen.patch %description Sos is a set of tools that gathers information about system @@ -34,6 +36,8 @@ support technicians and developers. %setup -qn %{name}-%{version} %setup -T -D -a1 -q %patch -P 1 -p1 +%patch -P 2 -p1 +%patch -P 3 -p1 %build %py3_build @@ -62,8 +66,6 @@ cd .. # %%files -f %%{name}.lang %files %{_sbindir}/sos -%{_sbindir}/sosreport -%{_sbindir}/sos-collector #%dir /etc/sos/cleaner %dir /etc/sos/presets.d %dir /etc/sos/extras.d @@ -80,7 +82,7 @@ cd .. %package audit Summary: Audit use of some commands for support purposes -License: GPLv2+ +License: GPL-2.0-or-later Group: Application/System %description audit @@ -103,9 +105,20 @@ of the system. Currently storage and filesystem commands are audited. %{_mandir}/man8/sos-audit.sh.8.gz %ghost /etc/audit/rules.d/40-sos-filesystem.rules %ghost /etc/audit/rules.d/40-sos-storage.rules +%license LICENSE %changelog +* Fri May 30 2025 Jan Jansky = 4.9.1-2 +- Update to 4.9.1-2 in RHEL 10 + Resolves: RHEL-86667 + Resolves: RHEL-86651 + +* Tue Apr 15 2025 Jan Jansky = 4.9.1-1 +- Update to 4.9.1 in RHEL 10 + Resolves: RHEL-86667 + Resolves: RHEL-86651 + * Fri Jan 24 2025 Jan Jansky = 4.8.2-2 - Add new plugin aap_containerized Resolves: RHEL-75977 diff --git a/sources b/sources index 0a334af..0d0fea8 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (sos-4.8.2.tar.gz) = 1050f35e90723252821a7fe02d506f5a5a6c21a2f91fef80443d719b4dbb26563a761d1fb84cf40a19eeb267e1c1500514f21a8d0b5513db52d5ff0019ea32d8 -SHA512 (sos-audit-0.3.tgz) = 32597baf6350804d08179a0dbe48470a93df148e83d2e49bb3288f6bcc2d151bb1433761913bfbccd912c14de92435939fef5bcd7e091dfe33a345d61ea842ea +SHA512 (sos-4.9.1.tar.gz) = 21b51f50f376689c19dae112ab0fe8a0e56dcef83bcfcf7e23f78033b1f87d4f7568a68948019f15bb546325f4b872b8ffae7e8f137896c5be22586c0eb5c85d +SHA512 (sos-audit-0.3-1.tgz) = 24c7bfec7e47a082ca1f2a96c5ad455c692d81dcc4339877de5bd324719609d91bc0ef6ddb95485fb75b81f90f8a7cc58370ada6f626c275bab36e9e2a409330