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 1380697 - selinux prevents executing scripts by zabbix-agent
Summary: selinux prevents executing scripts by zabbix-agent
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-30 11:09 UTC by Eugene Peregudov
Modified: 2018-10-30 10:00 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.13.1-203.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:59:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3111 0 None None None 2018-10-30 10:00:50 UTC

Description Eugene Peregudov 2016-09-30 11:09:53 UTC
Description of problem:

I'm trying to monitor Haproxy instance via custom script for Zabbix agent.
Default system policy contains contexts for directories with external scripts:

# semanage fcontext -l | grep zabbix | grep script
/usr/lib/zabbix/externalscripts(/.*)?              all files          system_u:object_r:zabbix_script_exec_t:s0
/var/lib/zabbix/externalscripts(/.*)?              all files          system_u:object_r:zabbix_script_exec_t:s0

SELinux prevents executing scripts by zabbix-agent with this audit message:

type=AVC msg=audit(1475181608.675:258818): avc:  denied  { execute_no_trans } for  pid=18046 comm="sh" path="/var/lib/zabbix/externalscripts/haproxy_stats.sh" dev="dm-8" ino=29564421 scontext=system_u:system_r:zabbix_agent_t:s0 tcontext=unconfined_u:object_r:zabbix_script_exec_t:s0 tclass=file

Version-Release number of selected component (if applicable):
RHEL 7.2 x86_64
selinux-policy-targeted-3.13.1-60.el7_2.9.noarch
selinux-policy-3.13.1-60.el7_2.9.noarch

How reproducible:
Always.

Steps to Reproduce:
1. Install RHEL 7.2 x86_64
2. Install zabbix-agent
3. Call custom script from /var/lib/zabbix/externalscripts/ with zabbix-agent (or call direct with source domain zabbix_agent_t)

Actual results:

SELinux prevents executing the script

Expected results:

Script will be run with zabbix_script_t domain

Additional info:

Scripts are working after installing custom module:

module zabbix_agent 1.0.1;

require {
    type zabbix_script_exec_t;
    type zabbix_script_t;
    type zabbix_agent_t;
    class file { ioctl read getattr execute open };
    class dir { ioctl read getattr lock search open };
    class process { transition sigchld };
    class fifo_file { ioctl read write getattr lock append };
    class fd use;
}

#============= zabbix_agent_t ==============
allow zabbix_agent_t zabbix_script_exec_t : file { ioctl read getattr execute open } ;
allow zabbix_agent_t zabbix_script_exec_t : dir { ioctl read getattr lock search open } ;
allow zabbix_agent_t zabbix_script_t : process transition ;
type_transition zabbix_agent_t zabbix_script_exec_t : process zabbix_script_t;

#============= zabbix_script_t =============
allow zabbix_script_t zabbix_agent_t : process sigchld ;
allow zabbix_script_t zabbix_agent_t : fd use ;
allow zabbix_script_t zabbix_agent_t : fifo_file { ioctl read write getattr lock append } ;

Please, update zabbix module in default system policy.

Comment 7 errata-xmlrpc 2018-10-30 09:59:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3111


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