Bug 550578 - SELinux nagios policy creates nagios.pid with wrong context.
Summary: SELinux nagios policy creates nagios.pid with wrong context.
Keywords:
Status: CLOSED DUPLICATE of bug 548638
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-26 05:40 UTC by Steve Traylen
Modified: 2009-12-28 11:56 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-12-28 11:56:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Steve Traylen 2009-12-26 05:40:31 UTC
Description of problem:

/var/run/nagios.pid as created by nagios

# ls --scontext /var/run/nagios.pid 
unconfined_u:object_r:initrc_var_run_t:s0 /var/run/nagios.pid

It can be restored with:
# restorecon /var/run/nagios.pid 
# ls --scontext /var/run/nagios.pid 
system_u:object_r:nagios_var_run_t:s0 /var/run/nagios.pid

but /usr/sbin/nagios never creates it in this and it probably should?

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

selinux-policy-targeted-3.6.32-59.fc12.noarch


How reproducible:
Every time.

Steps to Reproduce:
1. service nagios restart
2. Examine AVC logs
3. ls --scontext /var/run/nagios.pid 


Actual results:

AVC logs appear
unconfined_u:object_r:initrc_var_run_t:s0 /var/run/nagios.pid

Expected results:
AVC logs should probably not appear.

system_u:object_r:nagios_var_run_t:s0 /var/run/nagios.pid


Additional info:


SELinux is preventing /usr/sbin/nagios "write" access to /var/run/nagios.pid.

Detailed Description:

[SELinux is in permissive mode. This access was not denied.]

SELinux denied access requested by nagios. /var/run/nagios.pid may be a
mislabeled. /var/run/nagios.pid default SELinux type is nagios_var_run_t, but
its current type is initrc_var_run_t. Changing this file back to the default
type, may fix your problem.

File contexts can be assigned to a file in the following ways.

  * Files created in a directory receive the file context of the parent
    directory by default.
  * The SELinux policy might override the default label inherited from the
    parent directory by specifying a process running in context A which creates
    a file in a directory labeled B will instead create the file with label C.
    An example of this would be the dhcp client running with the dhclient_t type
    and creating a file in the directory /etc. This file would normally receive
    the etc_t type due to parental inheritance but instead the file is labeled
    with the net_conf_t type because the SELinux policy specifies this.
  * Users can change the file context on a file using tools such as chcon, or
    restorecon.

This file could have been mislabeled either by user error, or if an normally
confined application was run under the wrong domain.

However, this might also indicate a bug in SELinux because the file should not
have been labeled with this type.

If you believe this is a bug, please file a bug report against this package.

Allowing Access:

You can restore the default system context to this file by executing the
restorecon command. restorecon '/var/run/nagios.pid', if this file is a
directory, you can recursively restore using restorecon -R
'/var/run/nagios.pid'.

Fix Command:

/sbin/restorecon '/var/run/nagios.pid'

Additional Information:

Source Context                system_u:system_r:nagios_t:s0
Target Context                system_u:object_r:initrc_var_run_t:s0
Target Objects                /var/run/nagios.pid [ file ]
Source                        nagios
Source Path                   /usr/sbin/nagios
Port                          <Unknown>
Host                          bottom.home
Source RPM Packages           nagios-3.2.0-2.fc12
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.32-59.fc12
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Plugin Name                   restorecon
Host Name                     bottom.home
Platform                      Linux bottom.home 2.6.31.6-166.fc12.x86_64 #1 SMP
                              Wed Dec 9 10:46:22 EST 2009 x86_64 x86_64
Alert Count                   2
First Seen                    Wed 23 Dec 2009 07:22:10 PM CET
Last Seen                     Fri 25 Dec 2009 11:56:23 PM CET
Local ID                      6853ea5e-d131-4561-9803-3a8bfa2c1659
Line Numbers                  

Raw Audit Messages            

node=bottom.home type=AVC msg=audit(1261781783.549:11): avc:  denied  { write } for  pid=2185 comm="nagios" name="nagios.pid" dev=md3 ino=1042 scontext=system_u:system_r:nagios_t:s0 tcontext=system_u:object_r:initrc_var_run_t:s0 tclass=file

node=bottom.home type=SYSCALL msg=audit(1261781783.549:11): arch=c000003e syscall=2 success=yes exit=4 a0=23d8110 a1=42 a2=1a4 a3=7fff7ac16180 items=0 ppid=2176 pid=2185 auid=4294967295 uid=490 gid=472 euid=490 suid=490 fsuid=490 egid=472 sgid=472 fsgid=472 tty=(none) ses=4294967295 comm="nagios" exe="/usr/sbin/nagios" subj=system_u:system_r:nagios_t:s0 key=(null)

Comment 1 Miroslav Grepl 2009-12-28 11:56:14 UTC

*** This bug has been marked as a duplicate of bug 548638 ***


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