Bug 1047720

Summary: munin-cgi doesn't work with SELinux. Default install produces error 500.
Product: [Fedora] Fedora Reporter: Vadim Trochinsky <rh.bugzilla>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: drjohnson1, dwalsh, ingvar, jvanek, mathieu-acct
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.12.1-171.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-26 01:54:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Comment none

Description Vadim Trochinsky 2014-01-02 01:15:57 UTC
Description of problem:

Installed munin and munin-cgi on a new server. Tried using the web interface, got error 500. Debugging is complicated by that some of the errors are suppressed by a dontaudit rule.


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

munin-cgi-2.0.19-1.fc20.noarch

How reproducible:

100%

Steps to Reproduce:
1. Install munin-cgi
2. Go to the website

Actual results:

Error 500

Expected results:

Should work

Additional info:

audit2allow generated the following:

module munin-local 1.0;

require {
        type munin_log_t;
        type httpd_t;
        type httpd_munin_script_t;
        type munin_etc_t;
        class process { siginh noatsecure rlimitinh };
        class unix_stream_socket { write ioctl shutdown read getattr accept };
        class dir { write read add_name };
        class file create;
}

#============= httpd_munin_script_t ==============

#!!!! This avc has a dontaudit rule in the current policy
allow httpd_munin_script_t httpd_t:unix_stream_socket { read write };
allow httpd_munin_script_t httpd_t:unix_stream_socket { ioctl accept getattr shutdown };
allow httpd_munin_script_t munin_etc_t:dir read;
allow httpd_munin_script_t munin_log_t:dir { write add_name };
allow httpd_munin_script_t munin_log_t:file create;

#============= httpd_t ==============

#!!!! This avc has a dontaudit rule in the current policy
allow httpd_t httpd_munin_script_t:process { siginh rlimitinh noatsecure };

Comment 1 Vadim Trochinsky 2014-01-02 01:32:54 UTC
Oops, disregard the previous policy. With that graphing is still broken. Better one:

module munin-local 1.0;

require {
        type munin_log_t;
        type munin_etc_t;
        type httpd_t;
        type httpd_munin_script_t;
        type tmp_t;
        class process { siginh noatsecure rlimitinh };
        class unix_stream_socket { write getattr shutdown read ioctl accept };
        class dir { write read remove_name create add_name };
        class file { write setattr create unlink open };
}

#============= httpd_munin_script_t ==============
allow httpd_munin_script_t httpd_t:unix_stream_socket { write getattr shutdown read ioctl accept };
allow httpd_munin_script_t munin_etc_t:dir read;
allow httpd_munin_script_t munin_log_t:dir { write add_name };
allow httpd_munin_script_t munin_log_t:file create;
allow httpd_munin_script_t tmp_t:dir { write remove_name create add_name };
allow httpd_munin_script_t tmp_t:file { write create unlink open setattr };

#============= httpd_t ==============
allow httpd_t httpd_munin_script_t:process { siginh rlimitinh noatsecure };

Comment 2 d. johnson 2014-01-02 14:14:36 UTC
Please attach the original AVC's. These can be passed along and isolated better than the policy you posted above.

Example:

sudo ausearch -m avc -ts recent > /tmp/recent-avc.txt

Comment 3 Mathieu Chouquet-Stringer 2014-06-02 19:41:26 UTC
Hi,

To be able to do the same thing (namely html pages and graphs being created by CGIs), I needed the following:

module munin-local 1.0;

require {
        type tmp_t;
        type httpd_munin_script_t;
        type munin_etc_t;
        class file { write create unlink open setattr };
        class dir { write remove_name create read add_name };
}

#============= httpd_munin_script_t ==============

allow httpd_munin_script_t munin_etc_t:dir read;

allow httpd_munin_script_t tmp_t:dir { write remove_name create add_name };

allow httpd_munin_script_t tmp_t:file { write create unlink open setattr };



If you have more questions, let me know.

Comment 4 d. johnson 2014-06-03 01:17:44 UTC
Please attach the original AVC's. These can be passed along and isolated better than the policy you posted above.

Example:

sudo ausearch -m avc -ts recent > /tmp/recent-avc.txt

Comment 5 d. johnson 2014-06-03 01:19:52 UTC
Also, please update to munin-2.0.21-1.fc20.noarch

Comment 6 Mathieu Chouquet-Stringer 2014-06-03 05:24:55 UTC
Created attachment 915914 [details]
Comment

(This comment was longer than 65,535 characters and has been moved to an attachment by Red Hat Bugzilla).

Comment 7 Miroslav Grepl 2014-06-03 14:39:06 UTC
commit 6a4e4f91f4f454fa75edf080cfafa8e573ca7426
Author: Miroslav Grepl <mgrepl>
Date:   Tue Jun 3 16:38:01 2014 +0200

    Add fixes to make munin and munin-cgi working

Comment 8 Fedora Update System 2014-06-09 20:09:21 UTC
selinux-policy-3.12.1-167.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-167.fc20

Comment 9 Fedora Update System 2014-06-11 16:25:41 UTC
Package selinux-policy-3.12.1-167.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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.12.1-167.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7240/selinux-policy-3.12.1-167.fc20
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2014-06-19 13:19:21 UTC
selinux-policy-3.12.1-171.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-171.fc20

Comment 11 Fedora Update System 2014-06-19 22:53:32 UTC
Package selinux-policy-3.12.1-171.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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.12.1-171.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-7499/selinux-policy-3.12.1-171.fc20
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2014-06-26 01:54:12 UTC
selinux-policy-3.12.1-171.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.