Bug 720315 - SELinux is preventing /usr/sbin/mcelog from 'create open' accesses on the file /var/log/mcelog.
Summary: SELinux is preventing /usr/sbin/mcelog from 'create open' accesses on the fil...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 14
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-11 11:24 UTC by John Freed
Modified: 2011-11-29 19:46 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.9.7-44.fc14
Clone Of:
Environment:
Last Closed: 2011-08-12 11:01:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description John Freed 2011-07-11 11:24:11 UTC
SELinux is preventing /usr/sbin/mcelog from 'create open' accesses on the file /var/log/mcelog.

SELinux is preventing /usr/sbin/mcelog from 'write add_name' accesses on the directory /var/log.

Description of Problem:

This occurs when the mcelog cron job runs. The default cron job reads as follows:
/usr/sbin/mcelog --ignorenodev --filter >>/var/log/mcelog

An alternative (documented) method, avoiding the shell redirect, is:

/usr/sbin/mcelog --ignorenodev --filter --logfile=/var/log/mcelog

The first (redirect) method produces a file with this context:

system_u:object_r:cron_log_t:s0 

(This is also the context produced by restorecon)

The second method produces a file with this context:

system_u:object_r:var_log_t:s0

To get the second one to function, regardless of whether the logfile existed or had been created with a cron_log_t type, I needed to do the following:


#============= start module mcelog.te ==============
module mcelog 1.0;

require {
	type mcelog_t;
	type var_log_t;
	type cron_log_t;
	class file { create open };
	class dir { write add_name };
}

#============= mcelog_t ==============
allow mcelog_t cron_log_t:file open;
allow mcelog_t var_log_t:dir { write add_name };
allow mcelog_t var_log_t:file { create open };

#============= end module mcelog.te ==============

The ONLY other cron job I could find on my system that uses a shell redirect to a logfile is prelink, but that has its own context of prelink_log_t. It seems sensible to me to have mcelog follow that route and have a type of mcelog_log_t, but I leave that to wiser heads.



#============= other info ==============

Source Path                   /usr/sbin/mcelog
Source RPM Packages           mcelog-0.9pre1-0.1.fc13
Policy RPM                    selinux-policy-3.9.7-40.fc14
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Platform                      Linux (removed) 2.6.35.13-92.fc14.x86_64 #1 SMP Sat
                              May 21 17:26:25 UTC 2011 x86_64 x86_64

Comment 1 Daniel Walsh 2011-07-11 18:20:24 UTC
I think it is best if we make the log file labeled mcelog_log_t and add it to policy.

Comment 2 Miroslav Grepl 2011-07-12 10:14:10 UTC
Fixed in selinux-policy-3.9.7-44.fc14

Comment 3 Fedora Update System 2011-08-04 13:58:40 UTC
selinux-policy-3.9.7-44.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-44.fc14

Comment 4 Fedora Update System 2011-08-05 03:53:49 UTC
Package selinux-policy-3.9.7-44.fc14:
* should fix your issue,
* was pushed to the Fedora 14 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.9.7-44.fc14'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.7-44.fc14
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2011-08-12 11:00:48 UTC
selinux-policy-3.9.7-44.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2011-08-12 18:25:14 UTC
selinux-policy-3.9.7-44.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


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