Bug 722536 - selinux policy does not permit rsyslog(-mysql) to access the mysql database
Summary: selinux policy does not permit rsyslog(-mysql) to access the mysql database
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: selinux-policy
Version: 5.6
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Karel Srot
: 727550 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2011-07-15 15:31 UTC by Erik M Jacobs
Modified: 2012-10-11 08:06 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-2.4.6-317.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-02-21 05:47:40 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0158 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2012-02-20 14:53:50 UTC

Description Erik M Jacobs 2011-07-15 15:31:23 UTC
Description of problem:
rsyslog-mysql provides for the ability for rsyslog to put log information into a mysql database.  The current selinux-policy (2.4.6-300.el5_6.1) does not appear to provide the correct access

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

How reproducible:

Steps to Reproduce:
1. install rsyslog/rsyslog-mysql/mysql
2. set everything up
3. run rsyslog/mysql
Actual results:
When rsyslog attempts to connect to the database, you get an AVC denial.

Expected results:
rsyslog should be able to read the database

Additional info:
type=AVC msg=audit(1310742955.892:196139): avc:  denied  { search } for  pid=32754 comm="rsyslogd" name="mysql" dev=md1 ino=331710489 scontext=user_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:mysqld_db_t:s0 tclass=dir

#============= syslogd_t ==============
allow syslogd_t mysqld_db_t:dir search;

Comment 1 Miroslav Grepl 2011-07-15 15:35:01 UTC
We have also this in RHEL6


Comment 2 Daniel Walsh 2011-07-15 17:43:11 UTC
Looks good to me.

Comment 3 Erik M Jacobs 2011-07-22 18:17:13 UTC
Here's what I ended up with:

require {
	type syslogd_t;
	type mysqld_t;
	type mysqld_var_run_t;
	type mysqld_db_t;
	class sock_file write;
	class unix_stream_socket connectto;
	class dir search;

#============= syslogd_t ==============
allow syslogd_t mysqld_db_t:dir search;
allow syslogd_t mysqld_t:unix_stream_socket connectto;
allow syslogd_t mysqld_var_run_t:sock_file write;

This appears to grant sufficient access for rsyslog to write into the database.

Comment 4 Miroslav Grepl 2011-07-25 12:16:47 UTC
Yes it will covered by 


Comment 5 Erik M Jacobs 2011-07-25 12:47:07 UTC
OK -- guess I don't understand enough about how SELinux works.  Suppose that's all good, then! Any ETA?

Comment 6 Miroslav Grepl 2011-07-28 12:11:31 UTC
Well, this is for RHEL5.8 which I guess is in planning. If I get all acks I will do a build.

Comment 7 Karel Srot 2011-08-23 13:21:45 UTC
*** Bug 727550 has been marked as a duplicate of this bug. ***

Comment 9 Miroslav Grepl 2011-09-29 11:29:44 UTC
Fixed in selinux-policy-2.4.6-317.el5

Comment 13 errata-xmlrpc 2012-02-21 05:47:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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