审计表示什么都不做,但木偶将不会运行SELinux强制执行

我决定让我的木偶大师与SELinux设置强制执行。 如果我放任它,它运行良好。

我在RHEL 7,systemd,apache2,乘客4和木偶3。

我已经使用审计日志和audit2allow通过了几遍,以制作覆盖审计日志的semodules。 (这是一个很大的混乱,乘客从apache模块运行,作为apache用户,执行木偶主代码。)

这是一个全新的configuration,所以puppet清单是一个默认的空节点,没有什么可做的。

如果我在远程计算机上运行“puppet agent -t”,它将成功执行setenforce 0.审计日志非常空。 (audit2allow报告“无事可做”。)

但是如果我把setenforce 1,我得到这些:

Aug 20 23:14:28 puppet002 puppet-master[1544]: Permission denied - /etc/puppet/auth.conf Aug 20 23:14:29 puppet002 puppet-master[1544]: Permission denied - /etc/puppet/manifests/site.pp on node agentserver.example.com 

我试过在/ etc / puppet / *上更改所有权,se上下文看起来很好:

 [root@puppet002 log]# cd /etc/puppet [root@puppet002 puppet]# ls -lZ -rw-r--r--. apache apache system_u:object_r:puppet_etc_t:s0 auth.conf -rw-r--r--. apache apache system_u:object_r:puppet_etc_t:s0 fileserver.conf drwxr-xr-x. apache apache system_u:object_r:puppet_etc_t:s0 manifests drwxr-xr-x. apache apache system_u:object_r:puppet_etc_t:s0 modules -rw-r--r--. apache apache system_u:object_r:puppet_etc_t:s0 puppet.conf 

任何疑难排解build议

[编辑]:附加信息,按照closures“dontaudit”的build议重复练习,错误信息改变了。 我的$ ssldir是/ var / lib / puppet / ssl,$ logdir是/ var / log / puppet,这使得这些错误变得有趣:

puppet-master [3210]:Permission denied – / etc / puppet / ssl

puppet-master [3210] 🙁 /文件[/ etc / puppet / ssl] /确保)从缺席变为目录失败:无法设置'目录'确保:权限被拒绝 – / etc / puppet / ssl

puppet-master [3210]:无法准备执行:初始化时出现3个故障:文件[/ etc / puppet / ssl]:从缺席变为目录失败:无法设置“目录”确保:权限被拒绝 – / etc / puppet / ssl; 文件[/ etc / puppet / manifests]:从缺席变为目录失败:无法设置“目录”确保:权限被拒绝 – / etc / puppet / manifests; 文件[/ var / lib / puppet / log]:从0755更改为0750失败:无法在/ var / lib / puppet / log上设置模式755:权限被拒绝 – / var / lib / puppet / log

所有作品当然在宽容。 🙁

为了深入了解这个问题,我在puppet master上安装了setroubleshoot-server包。 而不是让机器进入Permissive模式,我把它放在了Enforcing中。 然后我把审计日志input到sealert,并得到这个gem:

 found 3 alerts in /var/log/audit/audit.log -------------------------------------------------------------------------------- SELinux is preventing /usr/bin/ruby from search access on the directory . ***** Plugin catchall (100. confidence) suggests ************************** If you believe that ruby should be allowed search access on the directory by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # grep ruby /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp 

事实上,这可以让木偶大师在强制模式下成功运行。

我的理论是,在强制模式下,Puppet master被触发到不同的代码path,触发附加访问警报,在Permissive模式下没有发现。