Bug 728566 - SELinux is preventing /usr/bin/perl from 'write' accesses on the directory /var/lib/pnp4nagios.
Summary: SELinux is preventing /usr/bin/perl from 'write' accesses on the directory /v...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 15
Hardware: i686
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: setroubleshoot_trace_hash:4e67c894b6c...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-05 15:45 UTC by Tobias
Modified: 2011-09-07 00:18 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-3.9.16-38.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-07 00:18:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tobias 2011-08-05 15:45:39 UTC
pnp4nagios not working after steps from README.fedora have been done:

SELinux is preventing /usr/bin/perl from 'write' accesses on the directory /var/lib/pnp4nagios.

*****  Plugin catchall_labels (83.8 confidence) suggests  ********************

If you want to allow perl to have write access on the pnp4nagios directory
Then you need to change the label on /var/lib/pnp4nagios
Do
# semanage fcontext -a -t FILE_TYPE '/var/lib/pnp4nagios'
where FILE_TYPE is one of the following: tmp_t, nagios_log_t, nagios_tmp_t, var_spool_t, var_run_t, var_log_t, nagios_var_run_t, nagios_spool_t, root_t. 
Then execute: 
restorecon -v '/var/lib/pnp4nagios'


*****  Plugin catchall (17.1 confidence) suggests  ***************************

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

Additional Information:
Source Context                system_u:system_r:nagios_t:s0
Target Context                system_u:object_r:var_lib_t:s0
Target Objects                /var/lib/pnp4nagios [ dir ]
Source                        perl
Source Path                   /usr/bin/perl
Port                          <Unbekannt>
Host                          (removed)
Source RPM Packages           perl-5.12.4-159.fc15
Target RPM Packages           pnp4nagios-0.4.14-5.fc15
Policy RPM                    selinux-policy-3.9.16-35.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38.8-35.fc15.i686 #1 SMP
                              Wed Jul 6 14:46:26 UTC 2011 i686 i686
Alert Count                   16
First Seen                    Fr 05 Aug 2011 17:19:52 CEST
Last Seen                     Fr 05 Aug 2011 17:31:02 CEST
Local ID                      274ff186-ce55-42ee-8b68-aa938d556775

Raw Audit Messages
type=AVC msg=audit(1312558262.127:194): avc:  denied  { write } for  pid=26137 comm="perl" name="pnp4nagios" dev=dm-1 ino=1319368 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=dir


type=SYSCALL msg=audit(1312558262.127:194): arch=i386 syscall=mkdir success=no exit=EACCES a0=9795170 a1=1ff a2=415cf488 a3=960b008 items=0 ppid=26136 pid=26137 auid=4294967295 uid=493 gid=489 euid=493 suid=493 fsuid=493 egid=489 sgid=489 fsgid=489 tty=(none) ses=4294967295 comm=perl exe=/usr/bin/perl subj=system_u:system_r:nagios_t:s0 key=(null)

Hash: perl,nagios_t,var_lib_t,dir,write

audit2allow

#============= nagios_t ==============
#!!!! This avc is allowed in the current policy

allow nagios_t var_lib_t:dir write;

audit2allow -R

#============= nagios_t ==============
#!!!! This avc is allowed in the current policy

allow nagios_t var_lib_t:dir write;



------------


Now works with the following module:

module nagiosown 1.0;

require {
	type nagios_t;
	type nagios_var_run_t;
	type var_lib_t;
	class dir { write create };
}

#============= nagios_t ==============
allow nagios_t nagios_var_run_t:dir create;
#!!!! The source type 'nagios_t' can write to a 'dir' of the following types:
# tmp_t, nagios_log_t, nagios_tmp_t, var_spool_t, var_run_t, var_log_t, nagios_var_run_t, nagios_spool_t, root_t

allow nagios_t var_lib_t:dir write;

Comment 1 Daniel Walsh 2011-08-05 17:03:27 UTC
I update F16 nagios policy to allow this.

Comment 2 Miroslav Grepl 2011-08-08 06:39:02 UTC
Fixed in selinux-policy-3.9.16-38.fc15

Comment 3 Fedora Update System 2011-08-11 20:39:07 UTC
selinux-policy-3.9.16-38.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-38.fc15

Comment 4 Fedora Update System 2011-08-12 18:19:46 UTC
Package selinux-policy-3.9.16-38.fc15:
* should fix your issue,
* was pushed to the Fedora 15 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.16-38.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/selinux-policy-3.9.16-38.fc15
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2011-09-07 00:16:52 UTC
selinux-policy-3.9.16-38.fc15 has been pushed to the Fedora 15 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.