Bug 919781

Summary: SELinux alerts about systemd read and getattr access in Nautilus after system update
Product: [Fedora] Fedora Reporter: Andrew <theamazingchiepoo>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: unspecified    
Version: 18CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-14 02:59:49 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 Andrew 2013-03-10 04:09:07 UTC
Description of problem:

When launching Nautilus after a system update, two SELinux Alerts appears about systemd (about read and getattr access). The alerts read as follows:

Alert #1:

SELinux is preventing /usr/lib/systemd/systemd-hostnamed from read access on the file /etc/hostname.

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

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

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

If you believe that systemd-hostnamed 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                system_u:object_r:etc_runtime_t:s0
Target Objects                /etc/hostname [ file ]
Source                        systemd-hostnam
Source Path                   /usr/lib/systemd/systemd-hostnamed
Port                          <Unknown>
Host                          localhost.private
Source RPM Packages           systemd-197-1.fc18.2.x86_64
Target RPM Packages           systemd-197-1.fc18.2.x86_64
Policy RPM                    selinux-policy-3.11.1-82.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.private
Platform                      Linux localhost.private 3.8.1-201.fc18.x86_64 #1
                              SMP Thu Feb 28 19:23:08 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-03-09 22:39:20 EST
Last Seen                     2013-03-09 22:39:20 EST
Local ID                      bebba614-de58-4244-b732-b6d939ed1edf

Raw Audit Messages
type=AVC msg=audit(1362886760.43:318): avc:  denied  { read } for  pid=1775 comm="systemd-hostnam" name="hostname" dev="sda3" ino=1415419 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_runtime_t:s0 tclass=file


type=AVC msg=audit(1362886760.43:318): avc:  denied  { open } for  pid=1775 comm="systemd-hostnam" path="/etc/hostname" dev="sda3" ino=1415419 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_runtime_t:s0 tclass=file


type=SYSCALL msg=audit(1362886760.43:318): arch=x86_64 syscall=open success=yes exit=EINTR a0=7f8cb3022d68 a1=80000 a2=1b6 a3=238 items=0 ppid=1 pid=1775 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=systemd-hostnam exe=/usr/lib/systemd/systemd-hostnamed subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null)

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

audit2allow

#============= systemd_hostnamed_t ==============
allow systemd_hostnamed_t etc_runtime_t:file { read open };

audit2allow -R

#============= systemd_hostnamed_t ==============
allow systemd_hostnamed_t etc_runtime_t:file { read open };


Alert #2:

SELinux is preventing /usr/lib/systemd/systemd-hostnamed from getattr access on the file /etc/hostname.

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

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

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

If you believe that systemd-hostnamed should be allowed getattr 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                system_u:object_r:etc_runtime_t:s0
Target Objects                /etc/hostname [ file ]
Source                        systemd-hostnam
Source Path                   /usr/lib/systemd/systemd-hostnamed
Port                          <Unknown>
Host                          localhost.private
Source RPM Packages           systemd-197-1.fc18.2.x86_64
Target RPM Packages           systemd-197-1.fc18.2.x86_64
Policy RPM                    selinux-policy-3.11.1-82.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.private
Platform                      Linux localhost.private 3.8.1-201.fc18.x86_64 #1
                              SMP Thu Feb 28 19:23:08 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-03-09 22:39:20 EST
Last Seen                     2013-03-09 22:39:20 EST
Local ID                      510c3220-50f2-485b-a0e3-b36dba391e7e

Raw Audit Messages
type=AVC msg=audit(1362886760.43:319): avc:  denied  { getattr } for  pid=1775 comm="systemd-hostnam" path="/etc/hostname" dev="sda3" ino=1415419 scontext=system_u:system_r:systemd_hostnamed_t:s0 tcontext=system_u:object_r:etc_runtime_t:s0 tclass=file


type=SYSCALL msg=audit(1362886760.43:319): arch=x86_64 syscall=fstat success=yes exit=0 a0=4 a1=7fffdc8d1cc0 a2=7fffdc8d1cc0 a3=0 items=0 ppid=1 pid=1775 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=systemd-hostnam exe=/usr/lib/systemd/systemd-hostnamed subj=system_u:system_r:systemd_hostnamed_t:s0 key=(null)

Hash: systemd-hostnam,systemd_hostnamed_t,etc_runtime_t,file,getattr

audit2allow

#============= systemd_hostnamed_t ==============
allow systemd_hostnamed_t etc_runtime_t:file getattr;

audit2allow -R

#============= systemd_hostnamed_t ==============
allow systemd_hostnamed_t etc_runtime_t:file getattr;


Version-Release number of selected component (if applicable):

systemd 197-1.fc18.2 x86_64
selinux-policy 3.11.1-82.fc18 noarch
selinux-policy-targeted 3.11.1-82.fc18 noarch
nautilus 3.6.3-4.fc18 x86_64

How reproducible:

Always after complete system update


Steps to Reproduce:
1. Clean install Fedora 18
2. Perform system update
3. Open Nautilus
  
Actual results:

An SELinux Alert will appear immediately

Expected results:

No error message should appear

Comment 1 Miroslav Grepl 2013-03-12 09:35:34 UTC
Fixed in selinux-policy-3.11.1-85.fc18.noarch

Comment 2 Fedora Update System 2013-03-12 13:55:12 UTC
selinux-policy-3.11.1-85.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/FEDORA-2013-3605/selinux-policy-3.11.1-85.fc18

Comment 3 Fedora Update System 2013-03-12 23:34:45 UTC
Package selinux-policy-3.11.1-85.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.11.1-85.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-3605/selinux-policy-3.11.1-85.fc18
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-03-14 02:59:51 UTC
selinux-policy-3.11.1-85.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.