RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1446331 - SELinux is preventing munin-cgi-graph from altering munin_var_lib_t resources
Summary: SELinux is preventing munin-cgi-graph from altering munin_var_lib_t resources
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.9
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-27 16:57 UTC by tlum
Modified: 2017-10-02 13:25 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-02 13:25:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description tlum 2017-04-27 16:57:40 UTC
Description of problem:

When accessing http://server.domain.tld/munin/static/dynazoom.html?..., SELinux is preventing creation and alteration of munin_var_lib_t tagged resources. The zoom functionality dynamically creates munin_var_lib_t tagged directory structures and graph resources, and is trying to do so with an scontext of httpd_munin_script_t. According to the active policy, only the munin_t scontext has the permissions necessary to carry out the operations that are being attempted.

I also question the need for an httpd script to be doing a dir setattr on /var/cache/fontconfig, but that's a separate issue.


Version-Release number of selected component (if applicable):
CentOS release 6.9 (Final)
Linux munsrvp01 2.6.32-696.1.1.el6.i686 #1 SMP Tue Apr 11 16:37:48 UTC 2017 i686 i686 i386 GNU/Linux
selinux-policy.noarch                       3.7.19-307.el6
selinux-policy-targeted.noarch              3.7.19-307.el6
munin.noarch                                2.0.33-1.el6
httpd.i686                                  2.2.15-59.el6.centos

shell> semanage module -l | grep munin
munin                    1.7.0

How reproducible:
Alwayse

Steps to Reproduce:
1. Install munin and httpd
2. Set graph_strategy cron in /etc/munin/munin.conf
3. Wait for the cronjob to generate the configuration
4. Navigate to a nodes resource graph
5. Click on the resource graph to visit it's "dynazoom" link
6. Click the query button to regenerate the graph

Actual results:

Browser: "Missing image" icon
/var/log/munin/munin-cgi-graph.log: RDD Errors
/var/log/audit/audit.log: Multiple AVC's


Expected results:

Browser: An actual graph image and no errors or AVCs logged


Additional info:

The specific AVCs:
type=AVC msg=audit(1493310701.341:29359): avc:  denied  { setattr } for  pid=7168 comm="munin-cgi-graph" name="fontconfig" dev=dm-0 ino=5791 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:fonts_cache_t:s0 tclass=dir

type=SYSCALL msg=audit(1493310701.341:29359): arch=40000003 syscall=15 success=no exit=-1 a0=92cf430 a1=1ed a2=8e60c8 a3=92cf430 items=0 ppid=3679 pid=7168 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="munin-cgi-graph" exe="/usr/bin/perl" subj=system_u:system_r:httpd_munin_script_t:s0 key=(null)

<after a re-query>

type=AVC msg=audit(1493310940.408:29370): avc:  denied  { setattr } for  pid=7436 comm="munin-cgi-graph" name="fontconfig" dev=dm-0 ino=5791 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:fonts_cache_t:s0 tclass=dir

type=AVC msg=audit(1493310940.766:29371): avc:  denied  { write } for  pid=7436 comm="munin-cgi-graph" name="diskstats_iops" dev=dm-0 ino=393138 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=dir

type=AVC msg=audit(1493310940.766:29371): avc:  denied  { add_name } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=dir

type=AVC msg=audit(1493310940.766:29371): avc:  denied  { create } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=file

type=AVC msg=audit(1493310940.766:29371): avc:  denied  { write } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" dev=dm-0 ino=395491 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=file

type=AVC msg=audit(1493310941.087:29372): avc:  denied  { setattr } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" dev=dm-0 ino=395491 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=file

type=AVC msg=audit(1493310941.091:29373): avc:  denied  { remove_name } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" dev=dm-0 ino=395491 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=dir

type=AVC msg=audit(1493310941.091:29373): avc:  denied  { unlink } for  pid=7436 comm="munin-cgi-graph" name="sda-pinpoint=1493166786,1493274786.png?&lower_limit=&upper_limit=&size_x=800&size_y=400" dev=dm-0 ino=395491 scontext=system_u:system_r:httpd_munin_script_t:s0 tcontext=system_u:object_r:munin_var_lib_t:s0 tclass=file

audit2allow summarization of that mess:
#============= httpd_munin_script_t ==============
allow httpd_munin_script_t fonts_cache_t:dir setattr;
#!!!! The source type 'httpd_munin_script_t' can write to a 'dir' of the following types:
# httpd_munin_rw_content_t, munin_log_t, httpd_munin_script_tmp_t

allow httpd_munin_script_t munin_var_lib_t:dir { write remove_name add_name };
allow httpd_munin_script_t munin_var_lib_t:file { write create unlink setattr };

Dump of the relevant allow rules in munin.pp. The active policy implies that scontext httpd_munin_script_t is read_only and scontext munin_t is read_write, which conflicts with how scontext httpd_munin_script_t is being used:
shell> grep  'munin_var_lib_t\|fonts_cache_t' munin.sedismod.out
  allow munin_t munin_var_lib_t : [dir] { ioctl read write getattr lock add_name remove_name search open };
  allow munin_t munin_var_lib_t : [dir] { ioctl read write create getattr setattr lock unlink link rename add_name remove_name reparent search rmdir open };
  allow munin_t munin_var_lib_t : [dir] { ioctl read write getattr lock add_name remove_name search open };
  allow munin_t munin_var_lib_t : [file] { ioctl read write create getattr setattr lock append unlink link rename open };
  allow munin_t munin_var_lib_t : [dir] { ioctl read write getattr lock add_name remove_name search open };
  allow munin_t munin_var_lib_t : [lnk_file] { ioctl read write create getattr setattr lock append unlink link rename };
  allow munin_t [fonts_cache_t] : [dir] { ioctl read getattr lock search open };
  allow munin_t [fonts_cache_t] : [dir] { getattr search open };
  allow munin_t [fonts_cache_t] : [file] { ioctl read getattr lock open };
  allow munin_t [fonts_cache_t] : [dir] { getattr search open };
  allow munin_t [fonts_cache_t] : [lnk_file] { read getattr };
  allow munin_t [fonts_cache_t] : [dir] { setattr };
  allow munin_disk_plugin_t munin_var_lib_t : [dir] { getattr search open };
  allow munin_disk_plugin_t munin_var_lib_t : [file] { ioctl read write getattr lock append open };
  allow munin_mail_plugin_t munin_var_lib_t : [dir] { getattr search open };
  allow munin_mail_plugin_t munin_var_lib_t : [file] { ioctl read write getattr lock append open };
  allow munin_system_plugin_t munin_var_lib_t : [dir] { getattr search open };
  allow munin_system_plugin_t munin_var_lib_t : [file] { ioctl read write getattr lock append open };
  allow httpd_munin_script_t [fonts_cache_t] : [dir] { ioctl read getattr lock search open };
  allow httpd_munin_script_t [fonts_cache_t] : [dir] { getattr search open };
  allow httpd_munin_script_t [fonts_cache_t] : [file] { ioctl read getattr lock open };
  allow httpd_munin_script_t [fonts_cache_t] : [dir] { getattr search open };
  allow httpd_munin_script_t [fonts_cache_t] : [lnk_file] { read getattr };
  allow httpd_munin_script_t munin_var_lib_t : [dir] { getattr search open };
  allow httpd_munin_script_t munin_var_lib_t : [file] { ioctl read getattr lock open };

Comment 2 Lukas Vrabec 2017-10-02 13:25:11 UTC
Red Hat Enterprise Linux 6 transitioned to the Production 3 Phase on May 10, 2017.  During the Production 3 Phase, Critical impact Security Advisories (RHSAs) and selected Urgent Priority Bug Fix Advisories (RHBAs) may be released as they become available.

The official life cycle policy can be reviewed here:
http://redhat.com/rhel/lifecycle

This issue does not appear to meet the inclusion criteria for the Production Phase 3 and will be marked as CLOSED/WONTFIX. If this remains a critical requirement, please contact Red Hat Customer Support to request a re-evaluation of the issue, citing a clear business justification.  Red Hat Customer Support can be contacted via the Red Hat Customer Portal at the following URL:

https://access.redhat.com


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