Bug 1929267 - cleaner - default hostname not obfuscated unless host plugin ran
Summary: cleaner - default hostname not obfuscated unless host plugin ran
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: sos
Version: 8.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Moravec
QA Contact: Miroslav Hradílek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-16 15:31 UTC by Miroslav Hradílek
Modified: 2021-11-10 07:38 UTC (History)
6 users (show)

Fixed In Version: sos-4.1-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:36:07 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github sosreport sos pull 2406 0 None closed [clean] Fix hostnames not being obfuscated when host plugin wasn't run 2021-06-26 14:06:10 UTC
Red Hat Product Errata RHEA-2021:4388 0 None None None 2021-11-09 19:36:18 UTC

Description Miroslav Hradílek 2021-02-16 15:31:58 UTC
Description of problem:
Default hostname obfuscation provided by "sos clean" only works when sosreport contains files from "host" plugin of "sos report" component.

The cleanup is not performed despite default mapping containing the obfuscation of such hostname. Usage of the default mapping is confirmed by such hostname being included even in private mapping produced by cleaner run.

Version-Release number of selected component (if applicable):
sos-4.0-7.el8.noarch

How reproducible:
100%

Steps to Reproduce:
# rpm -q sos
sos-4.0-7.el8.noarch
# hostname
sostesthost.sossubdomain.redhat.com


# mkdir /etc/sos/cleaner/ # Overcome BZ#1923937
# sosreport -o logs -o host --batch
. . .
# tar -xf /var/tmp/sosreport-sostesthost-2021-02-16-iktgdbf.tar.xz
# cat sosreport-sostesthost-2021-02-16-iktgdbf/sos_commands/host/hostname
sostesthost.sossubdomain.redhat.com
# tail -n 2 sosreport-sostesthost-2021-02-16-iktgdbf/var/log/messages
Feb 16 13:51:23 sostesthost systemd[1]: Started Hostname Service.
Feb 16 13:51:53 sostesthost systemd[1]: systemd-hostnamed.service: Succeeded.
# sos clean --batch /var/tmp/sosreport-sostesthost-2021-02-16-iktgdbf.tar.xz
. . .
# tar -xf /var/tmp/sosreport-host0-2021-02-16-iktgdbf-obfuscated.tar.xz
# cat sosreport-host0-2021-02-16-iktgdbf/sos_commands/host/hostname
host0.obfuscateddomain1.com
# tail -n 2 sosreport-host0-2021-02-16-iktgdbf/var/log/messages
Feb 16 13:51:23 host0 systemd[1]: Started Hostname Service.
Feb 16 13:51:53 host0 systemd[1]: systemd-hostnamed.service: Succeeded.

# # At this point it correctly replaced hostnames and adds the hostname into mapping.

# cat /etc/sos/cleaner/default_mapping 
{
    "hostname_map": {
        "redhat.com": "obfuscateddomain0.com",
        "sostesthost.sossubdomain.redhat.com": "host0.obfuscateddomain1.com",
. . .
        "sostesthost": "host0",
. . .
# sosreport -o logs --batch
. . .
# tar -xf /var/tmp/sosreport-sostesthost-2021-02-16-qzbkssg.tar.xz
# tail -n 2 sosreport-sostesthost-2021-02-16-qzbkssg/var/log/messages
Feb 16 14:53:03 sostesthost systemd[1]: Started Network Manager Script Dispatcher Service.
Feb 16 14:53:14 sostesthost systemd[1]: NetworkManager-dispatcher.service: Succeeded.
# sos clean --batch /var/tmp/sosreport-sostesthost-2021-02-16-qzbkssg.tar.xz
. . .
# cat /var/tmp/sosreport-host0-2021-02-16-qzbkssg-private_map
{
    "hostname_map": {
        "redhat.com": "obfuscateddomain0.com",
        "sostesthost.sossubdomain.redhat.com": "host0.obfuscateddomain1.com",
. . .
        "sostesthost": "host0",
. . .
# tar -xf /var/tmp/sosreport-host0-2021-02-16-qzbkssg-obfuscated.tar.xz
. . .
# tail -n 2 sosreport-host0-2021-02-16-qzbkssg/var/log/messages
Feb 16 14:53:03 sostesthost systemd[1]: Started Network Manager Script Dispatcher Service.
Feb 16 14:53:14 sostesthost systemd[1]: NetworkManager-dispatcher.service: Succeeded.

# # At this point hostname is not replaced (is still sostesthost) despite private mapping containing it.

Comment 1 Jake Hunsaker 2021-02-16 15:38:50 UTC
This should be resolved by upstream PR #2406 - https://github.com/sosreport/sos/pull/2406.

As of right now this PR has not been merged as it is still awaiting further testing in upstream.

Comment 5 errata-xmlrpc 2021-11-09 19:36:07 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/RHEA-2021:4388


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