Bug 679234

Summary: SELinux is preventing /usr/bin/uptime from 'read' accesses on the file /var/run/utmp.
Product: [Fedora] Fedora Reporter: Peter Belew <abcruzww>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: dwalsh, mgrepl, timwa1
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:aba6dcab3239f43797832b6a052a6b904755a8dff820d0626e26c1afbd817fb6
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-22 09:35:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Peter Belew 2011-02-22 00:58:01 UTC
SELinux is preventing /usr/bin/uptime from 'read' accesses on the file /var/run/utmp.

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

If you believe that uptime should be allowed read access on the utmp 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 uptime /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:initrc_var_run_t:s0
Target Objects                /var/run/utmp [ file ]
Source                        uptime
Source Path                   /usr/bin/uptime
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           procps-3.2.8-15.fc14
Target RPM Packages           initscripts-9.20.1-1.fc14
Policy RPM                    selinux-policy-3.9.7-29.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.35.11-83.fc14.i686 #1 SMP
                              Mon Feb 7 07:04:18 UTC 2011 i686 i686
Alert Count                   10
First Seen                    Mon 21 Feb 2011 07:18:58 AM PST
Last Seen                     Mon 21 Feb 2011 04:03:21 PM PST
Local ID                      066dba0d-a521-4e87-86a4-c6008ca88158

Raw Audit Messages
type=AVC msg=audit(1298333001.551:23270): avc:  denied  { read } for  pid=7609 comm="uptime" name="utmp" dev=sda1 ino=156 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:initrc_var_run_t:s0 tclass=file


type=SYSCALL msg=audit(1298333001.551:23270): arch=i386 syscall=open success=no exit=EACCES a0=2b9b96 a1=88000 a2=270f a3=2b9b9c items=0 ppid=2708 pid=7609 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm=uptime exe=/usr/bin/uptime subj=system_u:system_r:httpd_t:s0 key=(null)

Hash: uptime,httpd_t,initrc_var_run_t,file,read

audit2allow

#============= httpd_t ==============
allow httpd_t initrc_var_run_t:file read;

audit2allow -R

#============= httpd_t ==============
allow httpd_t initrc_var_run_t:file read;

Comment 1 Miroslav Grepl 2011-02-22 09:35:40 UTC
Reading utmp file from apache is not something we want to support.

You have to add custom poliyc to allow this.

# grep uptime /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Comment 2 Daniel Walsh 2013-08-28 18:56:49 UTC
*** Bug 1001901 has been marked as a duplicate of this bug. ***