Bug 914862 - SELinux is preventing /usr/bin/perl from 'search' accesses on the directory /var/log/munin.
Summary: SELinux is preventing /usr/bin/perl from 'search' accesses on the directory /...
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:507b02b1c742cb81693bc5b6826...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-23 02:25 UTC by I. Piasecki
Modified: 2013-03-03 22:42 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-03-03 22:42:12 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
ausearch -m avc -ts recent (11.90 KB, text/x-log)
2013-02-26 23:10 UTC, I. Piasecki
no flags Details
semanage permissive -d httpd_munin_script_t (25.73 KB, text/x-log)
2013-02-26 23:13 UTC, I. Piasecki
no flags Details

Description I. Piasecki 2013-02-23 02:25:48 UTC
Description of problem:
Running munin and munin-node at localhost in Fedora 18 with selinux enabled.
SELinux is preventing /usr/bin/perl from 'search' accesses on the directory /var/log/munin.

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

If aby perl powinno mieć domyślnie search dostęp do munin directory.
Then proszę to zgłosić jako błąd.
Można utworzyć lokalny moduł polityki, aby umożliwić ten dostęp.
Do
można tymczasowo zezwolić na ten dostęp wykonując polecenia:
# grep munin-cgi-graph /var/log/audit/audit.log | audit2allow -M mojapolityka
# semodule -i mojapolityka.pp

Additional Information:
Source Context                system_u:system_r:httpd_munin_script_t:s0
Target Context                system_u:object_r:munin_log_t:s0
Target Objects                /var/log/munin [ dir ]
Source                        munin-cgi-graph
Source Path                   /usr/bin/perl
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           perl-5.16.2-238.fc18.x86_64
Target RPM Packages           munin-2.0.11.1-1.fc18.noarch
Policy RPM                    selinux-policy-3.11.1-79.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.7.9-201.fc18.x86_64 #1 SMP Mon
                              Feb 18 21:07:56 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-02-23 03:22:51 CET
Last Seen                     2013-02-23 03:22:51 CET
Local ID                      7bf7a3f0-0ada-417c-a1a6-3dc9e070e7e5

Raw Audit Messages
type=AVC msg=audit(1361586171.95:743): avc:  denied  { search } for  pid=17520 comm="munin-cgi-graph" name="munin" dev="md2" ino=5243153 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_log_t:s0 tclass=dir


type=SYSCALL msg=audit(1361586171.95:743): arch=x86_64 syscall=open success=no exit=EACCES a0=1a918b0 a1=441 a2=1b6 a3=0 items=0 ppid=17390 pid=17520 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 ses=4294967295 tty=(none) comm=munin-cgi-graph exe=/usr/bin/perl subj=system_u:system_r:httpd_munin_script_t:s0 key=(null)

Hash: munin-cgi-graph,httpd_munin_script_t,munin_log_t,dir,search

audit2allow

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

allow httpd_munin_script_t munin_log_t:dir search;

audit2allow -R

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

allow httpd_munin_script_t munin_log_t:dir search;


Additional info:
hashmarkername: setroubleshoot
kernel:         3.7.9-201.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-02-25 12:24:47 UTC
Does it need to read log files?

Could you re-test it with

# semanage permissive -a httpd_munin_script_t

re-test and

# ausearch -m avc -ts recent
# semanage permissive -d httpd_munin_script_t

Comment 2 I. Piasecki 2013-02-26 23:09:45 UTC
I had attached a log file with results of the command: ausearch -m avc -ts recent. try1.log

Comment 3 I. Piasecki 2013-02-26 23:10:17 UTC
Created attachment 703175 [details]
ausearch -m avc -ts recent

Comment 4 I. Piasecki 2013-02-26 23:13:46 UTC
Created attachment 703178 [details]
semanage permissive -d httpd_munin_script_t

And log after: semanage permissive -d httpd_munin_script_t

Comment 5 I. Piasecki 2013-02-26 23:17:08 UTC
By now i can't see zooming images in munin, a have this: 

Could not draw graph "/var/tmp/munin-cgi-graph/localhost/localhost/users-pinpoint=1358734810,1361586010.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" and apache error_log:

[Wed Feb 27 00:12:16.092158 2013] [cgi:error] [pid 1930] [client 127.0.0.1:34013] AH01215: (process:13354): GLib-WARNING **: getpwuid_r(): failed due to: Permission denied., referer: http://127.0.0.1/munin/static/dynazoom.html?cgiurl_graph=/munin-cgi/munin-cgi-graph&plugin_name=localhost/localhost/users&size_x=800&size_y=400&start_epoch=1358734810&stop_epoch=1361586010


So selinux is stopping my system from drawing graph like this above.

Comment 6 Miroslav Grepl 2013-02-28 12:32:12 UTC
I backported fixes from rawhide.

commit f6f7205015e2f4a3b8ebca4b1dbbfd538966183f
Author: Miroslav Grepl <mgrepl>
Date:   Thu Feb 28 13:30:52 2013 +0100

    Backport munin policy from rawhide

Comment 7 Fedora Update System 2013-03-01 13:04:21 UTC
selinux-policy-3.11.1-82.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-82.fc18

Comment 8 Fedora Update System 2013-03-02 20:14:52 UTC
Package selinux-policy-3.11.1-82.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-82.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-3309/selinux-policy-3.11.1-82.fc18
then log in and leave karma (feedback).

Comment 9 I. Piasecki 2013-03-02 21:22:42 UTC
SELinux is preventing /usr/bin/perl from using the execmem access on a process.

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

If jeśli perl powinno mieć domyślnie execmem dostęp do procesów z etykietami munin_t.
Then proszę to zgłosić jako błąd.
Można utworzyć lokalny moduł polityki, aby umożliwić ten dostęp.
Do
można tymczasowo zezwolić na ten dostęp wykonując polecenia:
# grep munin-update /var/log/audit/audit.log | audit2allow -M mojapolityka
# semodule -i mojapolityka.pp

Additional Information:
Source Context                system_u:system_r:munin_t:s0-s0:c0.c1023
Target Context                system_u:system_r:munin_t:s0-s0:c0.c1023
Target Objects                 [ process ]
Source                        munin-update
Source Path                   /usr/bin/perl
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           perl-5.16.2-238.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-82.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 3.7.9-205.fc18.x86_64
                              #1 SMP Sun Feb 24 20:10:02 UTC 2013 x86_64 x86_64
Alert Count                   410
First Seen                    2013-02-27 13:45:03 CET
Last Seen                     2013-03-02 22:20:01 CET
Local ID                      bcf91fc5-daaf-49de-9add-5437bc0afd9b

Raw Audit Messages
type=AVC msg=audit(1362259201.853:992): avc:  denied  { execmem } for  pid=15927 comm="munin-update" scontext=system_u:system_r:munin_t:s0-s0:c0.c1023 tcontext=system_u:system_r:munin_t:s0-s0:c0.c1023 tclass=process


type=SYSCALL msg=audit(1362259201.853:992): arch=x86_64 syscall=mmap success=no exit=EACCES a0=321c8ca000 a1=3d000 a2=7 a3=812 items=0 ppid=15926 pid=15927 auid=990 uid=990 gid=987 euid=990 suid=990 fsuid=990 egid=987 sgid=987 fsgid=987 ses=115 tty=(none) comm=munin-update exe=/usr/bin/perl subj=system_u:system_r:munin_t:s0-s0:c0.c1023 key=(null)

Hash: munin-update,munin_t,munin_t,process,execmem

audit2allow

#============= munin_t ==============
allow munin_t self:process execmem;

audit2allow -R

#============= munin_t ==============
allow munin_t self:process execmem;

Comment 10 I. Piasecki 2013-03-02 21:48:24 UTC
Look at bz: 913294 - selinux-policy-3.11.1-82.fc18.noarch still has some issue with munin.

Comment 11 Fedora Update System 2013-03-03 22:42:13 UTC
selinux-policy-3.11.1-82.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.