Bug 1953799

Summary: SELinux is preventing systemd-hostnam from 'write' accesses on the directory systemd.
Product: [Fedora] Fedora Reporter: Micah Shennum <jimtahu>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, plautrba, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5c77a73a2a60e564a32995eac7382dd20cb28b5a7313d409a09d3e437d9d89c9;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-27 10:17:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Micah Shennum 2021-04-27 00:51:04 UTC
Description of problem:
After making a new installation, changed the hostname (from "fedora" to "Atlantis"), then got this notificaiton.
SELinux is preventing systemd-hostnam from 'write' accesses on the directory systemd.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that systemd-hostnam should be allowed write access on the systemd directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'systemd-hostnam' --raw | audit2allow -M my-systemdhostnam
# semodule -X 300 -i my-systemdhostnam.pp

Additional Information:
Source Context                system_u:system_r:systemd_hostnamed_t:s0
Target Context                system_u:object_r:init_var_run_t:s0
Target Objects                systemd [ dir ]
Source                        systemd-hostnam
Source Path                   systemd-hostnam
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-34.3-1.fc34.noarch
Local Policy RPM              selinux-policy-targeted-34.3-1.fc34.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.11.15-300.fc34.x86_64 #1 SMP Fri
                              Apr 16 13:41:48 UTC 2021 x86_64 x86_64
Alert Count                   1
First Seen                    2021-04-26 19:48:10 CDT
Last Seen                     2021-04-26 19:48:10 CDT
Local ID                      b6310940-b45f-4c71-9741-0961dba7756f

Raw Audit Messages
type=AVC msg=audit(1619484490.498:1140): avc:  denied  { write } for  pid=54163 comm="systemd-hostnam" name="systemd" dev="tmpfs" ino=2 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:init_var_run_t:s0 tclass=dir permissive=0


Hash: systemd-hostnam,systemd_hostnamed_t,init_var_run_t,dir,write

Version-Release number of selected component:
selinux-policy-targeted-34.3-1.fc34.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.14.0
hashmarkername: setroubleshoot
kernel:         5.11.15-300.fc34.x86_64
type:           libreport

Comment 1 Micah Shennum 2021-04-27 00:53:10 UTC
Forgot to mention, changed the hostname with `sudo hostnamectl set-hostname Atlantis`

Comment 2 Zdenek Pytela 2021-04-27 10:17:13 UTC

*** This bug has been marked as a duplicate of bug 1953060 ***