Bug 2218279 - sos clean - Respect permissions of sanitised files
Summary: sos clean - Respect permissions of sanitised files
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: sos
Version: 8.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Pavel Moravec
QA Contact: Daniel Záležák
URL:
Whiteboard:
: 2221104 (view as bug list)
Depends On:
Blocks: 2221104
TreeView+ depends on / blocked
 
Reported: 2023-06-28 14:30 UTC by Jan Jansky
Modified: 2023-07-26 08:38 UTC (History)
10 users (show)

Fixed In Version: sos-4.5.5-2.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2221104 (view as bug list)
Environment:
Last Closed: 2023-07-26 08:37:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sosreport sos pull 3292 0 None open [clean] Respect permissions of sanitised files 2023-06-28 14:30:18 UTC
Red Hat Issue Tracker RHELPLAN-161115 0 None None None 2023-06-28 14:32:47 UTC

Description Jan Jansky 2023-06-28 14:30:19 UTC
Description of problem:
When copying files we applied a substitution in, we must replace just original file content (shutil.copyfile) and not also its stat data (shutil.copy).

Version-Release number of selected component (if applicable):
4.5.5

Comment 2 Pavel Moravec 2023-06-28 14:52:39 UTC
Trivial reproducer:

1) Ensure /etc/hosts has system's FQDN, e.g. add there:

echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts

2) Run:
# sos report --clean -o networking --batch --build
..
Your sosreport build tree has been generated in:
	/var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp

3) Compare permissions:
# ll /etc/hosts /var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp/etc/hosts
-rw-r--r--. 1 root root 1134 Jun 12 08:37 /etc/hosts
-rw-------. 1 root root  798 Jun 28 16:49 /var/tmp/sosreport-host4-8675309-2023-06-28-cxezxnp/etc/hosts
#

See the missing go+r flags.

Comment 3 Daniel Záležák 2023-07-05 18:46:29 UTC
Switched Tested based on positive results from manual test:

OLD
RHEL-8.9
x86_64
sos-4.5.1-3.el8.noarch

# echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts
# sos report --clean -o networking --batch --build
# ll /etc/hosts /var/tmp/sosreport-host0-2023-07-05-ihejuje/etc/host66
-rw-r--r--. 1 root root 304 Jul  5 14:35 /etc/hosts
-rw-------. 1 root root 202 Jul  5 14:29 /var/tmp/sosreport-host0-2023-07-05-ihejuje/etc/host66

``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

NEW
RHEL-8.9
x86_64
sos-4.5.5-1.el8.noarch

# echo $(ip a | grep -v "127.0.0.1/8" | grep -m1 "inet " | cut -d/ -f1 | awk '{ print $2 }') $(hostname -f) $(hostname -s) >> /etc/hosts
# sos report --clean -o networking --batch --build
# ll /etc/hosts /var/tmp/sosreport-host0-2023-07-05-peqncnf/etc/host66
-rw-r--r--. 1 root root 377 Jul  5 14:37 /etc/hosts
-rw-r--r--. 1 root root 290 Jul  5 14:37 /var/tmp/sosreport-host0-2023-07-05-peqncnf/etc/host66

Comment 6 Jan Jansky 2023-07-19 07:09:26 UTC
*** Bug 2221104 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2023-07-26 08:37:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sos bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:4279


Note You need to log in before you can comment on or make changes to this bug.