Bug 581270 - munin plugin selinux_avcstat can't read file /selinux/avc/cache_stats
Summary: munin plugin selinux_avcstat can't read file /selinux/avc/cache_stats
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: munin
Version: 13
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-11 13:35 UTC by Gabriele Pohl
Modified: 2011-06-27 15:31 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-27 15:31:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Gabriele Pohl 2010-04-11 13:35:56 UTC
Description of problem:

Get "Unknown" values fetching the values from munin-node.

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

munin-node-1.4.4-1.fc12.noarch

How reproducible:


Steps to Reproduce:

1. Install munin-node. 
   Autoconfiguration finds and can read the file /selinux/avc/cache_stats
   and therefore activates the plugin on the node.

2. See, that you get only "Unknown" values

----- 8< -----
# telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at localhost
fetch selinux_avcstat
lookups.value U
hits.value U
misses.value U
allocations.value U
reclaims.value U
frees.value U
.
----- >8 -----

  
Actual results:

No values in graph.

Expected results:

I got reasonable values from a plugin, 
when I run it via "munin-run" on the node:

----- 8< -----
# munin-run selinux_avcstat 
lookups.value 25863367
hits.value 25837715
misses.value 25652
allocations.value 25657
reclaims.value 24624
frees.value 25156
----- >8 -----

and also, when executing the script directly
even under user munin:

----- 8< -----
sudo -u munin /etc/munin/plugins/selinux_avcstat 
lookups.value 29744406
hits.value 29717050
misses.value 27356
allocations.value 27361
reclaims.value 26320
frees.value 26852
----- >8 -----

After setting SELinux mode to *permissive*
it worked also for the munin-node:

# telnet localhost 4949
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# munin node at localhost
fetch selinux_avcstat
lookups.value 33223592
hits.value 33194702
misses.value 28890
allocations.value 28900
reclaims.value 27856
frees.value 28392
.

Comment 1 Kevin Fenzi 2010-04-12 16:36:43 UTC
Can you look at your /var/log/audit/audit.log and attach the exact denials you are getting here?

Comment 2 Gabriele Pohl 2010-04-12 17:41:45 UTC
There are none.. 
I fetched the values via telnet, but that gives no entry in audit.log.
But when I switch to permissive node, the plugin works..

Format of the content of the file is similiar in both modes:

enforcing mode
# cat /selinux/avc/cache_stats 
lookups hits misses allocations reclaims frees
53079187 53046439 32748 32763 32224 32264
0 0 0 0 0 0

after switch to permissive
# cat /selinux/avc/cache_stats 
lookups hits misses allocations reclaims frees
53113195 53080428 32767 32782 32240 32280
0 0 0 0 0 0

I have no idea, what's happening there
and hope you have one..

Gabriele

Comment 3 Kevin Fenzi 2010-04-13 23:01:11 UTC
Possibly this is a 'noaudit' rule. 

Try: 

semodule -DB

This will disable ALL the no audit rules, so you will see a flood of things. 
Then try and isolate which log messages are from munin-node trying to access this. 

(then semodule -B to put them back to normal.)

Can you try that and see if you can get some audit messages from the failing case?

Comment 4 Gabriele Pohl 2010-04-18 17:41:11 UTC
ok, here they are:

type=AVC msg=audit(1271612210.775:312): avc:  denied  { getattr } for  pid=4587 comm="selinux_avcstat" path="/selinux/avc/cache_stats" dev=selinuxfs ino=24 scontext=system_u:system_r:munin_t:s0 tcontext=system_u:object_r:security_t:s0 tclass=file

type=SYSCALL msg=audit(1271612210.775:312): arch=40000003 syscall=195 success=no exit=-13 a0=8576ee8 a1=bff18a8c a2=5a3ff4 a3=8576ee8 items=0 ppid=4586 pid=4587 auid=4294967295 uid=0 gid=478 euid=0 suid=0 fsuid=0 egid=478 sgid=478 fsgid=478 tty=(none) ses=4294967295 comm="selinux_avcstat" exe="/bin/bash" subj=system_u:system_r:munin_t:s0 key=(null)

-Gabriele

Comment 5 arth 2010-05-05 19:54:57 UTC
Note:  In addition to getattr, you also need to allow read and open.

A .te file like this will serve as a test case, allowing the operation:

--- cut here ---
module muninlocal 0.0.1;

require {
        type munin_t;
        type security_t;
        class file { getattr read open };
}

allow munin_t security_t:file { getattr read open };
--- cut here ---

Save as muninlocal.te

Compile and install with:

checkmodule -M -m -o muninlocal.mod muninlocal.te
semodule_package -o muninlocal.pp muninlocal.mod
semodule -i muninlocal.pp

After this, "telnet localhost 4949", "fetch selinux_avcstat" and the values will be reported.

Comment 6 arth 2010-05-05 20:02:45 UTC
Err, the second line of compile/install should read:
semodule_package -o muninlocal.pp -m muninlocal.mod

Comment 7 Bug Zapper 2010-11-03 17:23:37 UTC
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Gabriele Pohl 2010-11-07 03:16:35 UTC
The recipe of arth works. Please add such a rule in Munins Policy.

Comment 9 Mike Tillberg 2010-11-18 01:43:39 UTC
This issue also exists in Fedora 14. and the policy changes from arth fix this issue.

Comment 10 d. johnson 2011-05-29 23:11:11 UTC
With a clean install + updates of F14 or F15, can you replicate this problem, and provide avc's?

If so, please change the version to "14" or "15" as appropriate.  F13 is going EOL in about 3 weeks.

Also include 'rpm -qa munin* selinux-policy*' output so they can be referenced.



Just for reference, the commands to build and install the policy from arth above could be shortened a bit too:

make -f /usr/share/selinux/devel/Makefile muninlocal.pp
semodule -i muninlocal.pp

Comment 11 Bug Zapper 2011-06-02 15:29:22 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 12 Bug Zapper 2011-06-27 15:31:36 UTC
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


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