Bug 960744 - SELinux is preventing /usr/lib64/nagios/plugins/check_mysql from 'getattr' accesses on the file /etc/my.cnf.
Summary: SELinux is preventing /usr/lib64/nagios/plugins/check_mysql from 'getattr' ac...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 18
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:a86c68d5ee84e8191c5cbd21a8f...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-07 20:38 UTC by Juan Orti
Modified: 2013-05-21 08:39 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-3.11.1-95.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-21 08:39:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Juan Orti 2013-05-07 20:38:21 UTC
Description of problem:
I was trying to check a local mysqld via NRPE in Nagios
SELinux is preventing /usr/lib64/nagios/plugins/check_mysql from 'getattr' accesses on the file /etc/my.cnf.

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

If cree que de manera predeterminada, check_mysql debería permitir acceso getattr sobre  my.cnf file.     
Then debería reportar esto como un error.
Puede generar un módulo de política local para permitir este acceso.
Do
permita el acceso momentáneamente executando:
# grep check_mysql /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:nagios_services_plugin_t:s0
Target Context                unconfined_u:object_r:mysqld_etc_t:s0
Target Objects                /etc/my.cnf [ file ]
Source                        check_mysql
Source Path                   /usr/lib64/nagios/plugins/check_mysql
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           nagios-plugins-mysql-1.4.16-5.fc18.x86_64
Target RPM Packages           mysql-libs-5.5.31-1.fc18.x86_64
Policy RPM                    selinux-policy-3.11.1-92.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.8.11-200.fc18.x86_64 #1 SMP Wed
                              May 1 19:44:27 UTC 2013 x86_64 x86_64
Alert Count                   2
First Seen                    2013-05-07 22:36:44 CEST
Last Seen                     2013-05-07 22:36:51 CEST
Local ID                      8a829da0-1d5d-4e74-af3c-4a6740a01197

Raw Audit Messages
type=AVC msg=audit(1367959011.319:6221): avc:  denied  { getattr } for  pid=18156 comm="check_mysql" path="/etc/my.cnf" dev="dm-2" ino=921687 scontext=system_u:system_r:nagios_services_plugin_t:s0 tcontext=unconfined_u:object_r:mysqld_etc_t:s0 tclass=file


type=SYSCALL msg=audit(1367959011.319:6221): arch=x86_64 syscall=stat success=no exit=EACCES a0=7fffa4925f50 a1=7fffa4925cc0 a2=7fffa4925cc0 a3=7fffa49259e0 items=0 ppid=18155 pid=18156 auid=4294967295 uid=981 gid=976 euid=981 suid=981 fsuid=981 egid=976 sgid=976 fsgid=976 ses=4294967295 tty=(none) comm=check_mysql exe=/usr/lib64/nagios/plugins/check_mysql subj=system_u:system_r:nagios_services_plugin_t:s0 key=(null)

Hash: check_mysql,nagios_services_plugin_t,mysqld_etc_t,file,getattr

audit2allow

#============= nagios_services_plugin_t ==============
allow nagios_services_plugin_t mysqld_etc_t:file getattr;

audit2allow -R
require {
	type nagios_services_plugin_t;
}

#============= nagios_services_plugin_t ==============
mysql_read_config(nagios_services_plugin_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.8.11-200.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-05-09 11:43:55 UTC
commit 991233c3953d46449065486910947e50cdfe9c13
Author: Miroslav Grepl <mgrepl>
Date:   Thu May 9 13:42:26 2013 +0200

    Allow nagios service plugin to read mysql config files

Comment 2 Fedora Update System 2013-05-17 10:59:47 UTC
selinux-policy-3.11.1-95.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-95.fc18

Comment 3 Fedora Update System 2013-05-19 02:43:17 UTC
Package selinux-policy-3.11.1-95.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-95.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-8591/selinux-policy-3.11.1-95.fc18
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-05-21 08:39:12 UTC
selinux-policy-3.11.1-95.fc18 has been pushed to the Fedora 18 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.