NagEL Selinux上的RHEL7 equivelant上下文

我第一次安装了nagios核心和插件,并且无法与SElinux一起使用。 审计日志中的错误是,

type=AVC msg=audit(1441480084.865:710): avc: denied { execute } for pid=5444 comm="httpd" name="statusjson.cgi" dev="dm-1" ino=135240040 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=file 

系统: Scientific Linux 7 Nagios4.1.1

我按照这里的指示

它适用于SElinux处于宽容模式( setenforce 0

(对于想要弄清错误日志的人来说,SELinux策略默认情况下似乎没有审计httpd exec消息,我重build了SELinux策略,根据这篇文章启用所有的审计消息

 #semodule --disable_dontaudit --build 

并看着日志使用

 #sealert -a /var/log/audit/audit.log > auditlog.log 

另外,按照sealert的build议不适合我

因此,将CGI脚本的安全上下文更改为httpd_sys_script_exec_t似乎已经工作。 尽pipe我不确定这是否是所需的解决scheme。

 chcon -R -t httpd_sys_script_exec_t /usr/local/nagios/sbin 

更多信息: https : //fedoraproject.org/wiki/SELinux/apache

请注意, chcon仅临时更改上下文; 如果文件系统被重新标记或restorecon运行,上下文将恢复为默认types。 要永久更改上下文 ,请运行:

 semanage fcontext -a -t httpd_sys_script_exec_t /usr/local/nagios/sbin restorecon -v /usr/local/nagios/sbin