Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1929267

Summary: cleaner - default hostname not obfuscated unless host plugin ran
Product: Red Hat Enterprise Linux 8 Reporter: Miroslav Hradílek <mhradile>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: agk, bmr, jhunsaker, plambri, sbradley, theute
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.1-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:36:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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