Bug 1284289 - SELinux is preventing systemd-hostnam from 'read' accesses on the file /etc/hostname.
SELinux is preventing systemd-hostnam from 'read' accesses on the file /etc/h...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
22
x86_64 Unspecified
low Severity low
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
abrt_hash:06fef068541ef5f495ea1001236...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-22 17:50 EST by Richard Jasmin
Modified: 2015-11-23 05:17 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-23 05:17:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard Jasmin 2015-11-22 17:50:13 EST
Description of problem:
hostname edit was a while ago. tripped on yumex update of all things. Y is system not able to read its own files?
SELinux is preventing systemd-hostnam from 'read' accesses on the file /etc/hostname.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/etc/hostname default label should be hostname_etc_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /etc/hostname

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that systemd-hostnam should be allowed read access on the hostname file 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:
# grep systemd-hostnam /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:systemd_hostnamed_t:s0
Target Context                unconfined_u:object_r:user_home_t:s0
Target Objects                /etc/hostname [ file ]
Source                        systemd-hostnam
Source Path                   systemd-hostnam
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           systemd-219-25.fc22.x86_64
Policy RPM                    selinux-policy-3.13.1-128.18.fc22.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.2.6-200.fc22.x86_64 #1 SMP Tue
                              Nov 10 16:45:19 UTC 2015 x86_64 x86_64
Alert Count                   1
First Seen                    2015-11-22 16:46:58 CST
Last Seen                     2015-11-22 16:46:58 CST
Local ID                      f5151fe2-70d8-47b5-86d4-de9890449f55

Raw Audit Messages
type=AVC msg=audit(1448232418.43:1180): avc:  denied  { read } for  pid=30317 comm="systemd-hostnam" name="hostname" dev="dm-1" ino=1733242 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0


Hash: systemd-hostnam,systemd_hostnamed_t,user_home_t,file,read

Version-Release number of selected component:
selinux-policy-3.13.1-128.18.fc22.noarch

Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.2.6-200.fc22.x86_64
type:           libreport
Comment 1 Lukas Vrabec 2015-11-23 05:17:30 EST
You have bad SELinux context on /etc/hostname file. 
Fix it using:
*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/etc/hostname default label should be hostname_etc_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /etc/hostname

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