Bug 1819313

Summary: [DOC] journalctl --no-hostname option leaks hostname
Product: [Fedora] Fedora Reporter: Steve <y9t7sypezp>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: lnykryn, msekleta, s, systemd-maint, zbyszek
Target Milestone: ---Keywords: Documentation
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-245.6-2.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-05 02:29:28 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 Steve 2020-03-31 16:42:18 UTC
Description of problem:

The journalctl option "--no-hostname" removes most instances of the hostname from the output, but not all of them.

If the "--no-hostname" option is intended to protect confidential information in a user's hostname, the output should not contain the hostname anywhere.

This is a security concern for people who are asked to attach logs to bug reports.

If the intent of the "--no-hostname" option is simply to make the output more concise, then the journalctl man page should clearly state that the option does not remove all instances of the hostname from the output. In which case, this bug may be converted to a documentation bug.

Version-Release number of selected component (if applicable):
systemd-245.3-1.fc32.x86_64

How reproducible:
Always.

Steps to Reproduce:

$ hostname
f32-efi-test

$ journalctl -b --no-hostname | grep 'f32-efi-test' | grep -v 'audit'
Mar 31 16:07:08 systemd[1]: Set hostname to <f32-efi-test>.
Mar 31 16:07:15 systemd[1]: Set hostname to <f32-efi-test>.
Mar 31 16:07:22 avahi-daemon[762]: Server startup complete. Host name is f32-efi-test.local. Local service cookie is 80927380.
Mar 31 16:07:24 NetworkManager[821]: <info>  [1585670844.1846] hostname: hostname changed from (none) to "f32-efi-test"

For brevity, I have removed the audit records that also have the hostname.

Actual results:
The hostname appears in the output.

Expected results:
The hostname is removed from the output.

This:
Mar 31 16:07:08 systemd[1]: Set hostname to <f32-efi-test>.

Is changed to this:
Mar 31 16:07:08 systemd[1]: Set hostname to <removed>.

Additional info:

The template for reporting new kernel bugs explicitly cites the "--no-hostname" option:

7. Please attach the kernel logs. You can get the complete kernel log
   for a boot with ``journalctl --no-hostname -k > dmesg.txt``. If the
   issue occurred on a previous boot, use the journalctl ``-b`` flag.

Comment 1 Steve 2020-03-31 17:14:38 UTC
There is a complication when the hostname changes:

$ journalctl -b -31 --no-hostname -q --full --no-pager -g 'hostname changed'
Mar 27 12:08:13 NetworkManager[705]: <info>  [1585336093.8611] hostname: hostname changed from (none) to "f31-f32-test"
Mar 27 12:12:37 NetworkManager[705]: <info>  [1585336357.4614] hostname: hostname changed from "f31-f32-test" to "f32-test"

That leaks both the old hostname and the new hostname.

I'm changing this to a documentation bug ...

Comment 2 Steve 2020-03-31 17:23:32 UTC
For kernel bugs, the "-k" option is always specified, in which case, the NetworkManager records are not in the output:

$ journalctl -b -31 -k --no-hostname -q --full --no-pager -g 'hostname changed'
$ 

So we are left with two records from systemd:

$ journalctl -b -31 -k --no-hostname -q --full --no-pager -g 'f32-test'
Mar 27 12:08:03 systemd[1]: Set hostname to <f31-f32-test>.
Mar 27 12:08:08 systemd[1]: Set hostname to <f31-f32-test>.

Comment 3 Zbigniew Jędrzejewski-Szmek 2020-03-31 20:16:53 UTC
> If the "--no-hostname" option is intended to protect confidential information in a user's hostname

No, not at all. The option simply removes the "column" with the hostname. It is intended
to save space. No effort whatsoever is made to remove the hostname or other information
from the log contents.

I'll add a note to the docs.

Comment 4 Zbigniew Jędrzejewski-Szmek 2020-03-31 20:46:44 UTC
https://github.com/systemd/systemd/pull/15290

Comment 5 Steve 2020-03-31 20:50:27 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #4)
> https://github.com/systemd/systemd/pull/15290

Thanks. However: occurences -> occurrences

Comment 6 Fedora Update System 2020-05-31 10:54:09 UTC
FEDORA-2020-dd43dd05b1 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-dd43dd05b1

Comment 7 Fedora Update System 2020-06-01 03:12:31 UTC
FEDORA-2020-dd43dd05b1 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-dd43dd05b1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-dd43dd05b1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2020-06-02 10:10:29 UTC
FEDORA-2020-dd43dd05b1 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-dd43dd05b1

Comment 9 Fedora Update System 2020-06-03 03:11:29 UTC
FEDORA-2020-dd43dd05b1 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-dd43dd05b1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-dd43dd05b1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-06-05 02:29:28 UTC
FEDORA-2020-dd43dd05b1 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.