Selinux prevents the execution of zabbix custom script via sudo

Solution Verified - Updated -

Issue

  • Zabbix agent is running a custom script via sudo.
  • Selinux prevents the script from running.
  • This problem was reflecting on all Red Hat Enterprise Linux 7 systems with Selinux set to enforcing state & targeted type.
Zabbix configuration folder /etc/zabbix/
drwxr-xr-x. root   root   system_u:object_r:etc_t:s0       .
drwxr-xr-x. root   root   system_u:object_r:etc_t:s0       ..
drwx------. zabbix zabbix unconfined_u:object_r:etc_t:s0   scripts
-rw-r--r--. zabbix zabbix system_u:object_r:etc_t:s0       zabbix_agentd.conf
drwxr-xr-x. zabbix zabbix system_u:object_r:etc_t:s0       zabbix_agentd.d

Zabbix scripts /etc/zabbix/scripts/
drwx------. zabbix zabbix unconfined_u:object_r:etc_t:s0   .
-rwxr--r--. zabbix zabbix system_u:object_r:zabbix_script_exec_t:s0 passexp.sh
  • It occurs everytime when the script is running.
  • Need to know the correct labeling of Zabbix files and creating new selinux module for Zabbix

Environment

  • Red Hat Enterprise Linux 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content