Orl*_*rlo 5 linux audit selinux centos
我对 SELinux 有问题。setroubleshoot建议使mypol.pp用semodule -i mypol.pp这样的Apache可以运行。
运行建议的命令后,我不断收到:
type=AVC msg=audit(1388119964.806:11): avc: denied { execute } for pid=2174 comm="httpd" path="/etc/httpd/lib/libaprutil-1.so.0.5.3" dev=md0 ino=2228931 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_config_t:s0 tclass=file
**** Invalid AVC allowed in current policy ***
type=AVC msg=audit(1388120085.792:29): avc: denied { execute } for pid=2298 comm="httpd" path="/etc/httpd/lib/libaprutil-1.so.0.5.3" dev=md0 ino=2228931 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_config_t:s0 tclass=file
**** Invalid AVC allowed in current policy ***
type=AVC msg=audit(1388120159.57:37): avc: denied { execute } for pid=2330 comm="httpd" path="/etc/httpd/lib/libaprutil-1.so.0.5.3" dev=md0 ino=2228931 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_config_t:s0 tclass=file
**** Invalid AVC allowed in current policy ***
type=AVC msg=audit(1388121088.955:65): avc: denied { name_connect } for pid=2331 comm="httpd" dest=8080 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_cache_port_t:s0 tclass=tcp_socket
**** Invalid AVC allowed in current policy ***
found 0 alerts in /var/log/audit/audit.log
Run Code Online (Sandbox Code Playgroud)
以下情况向我表明您有重新标记问题。
type=AVC msg=audit(1388119964.806:11): avc: denied { execute } for pid=2174 comm="httpd" path="/etc/httpd/lib/libaprutil-1.so.0.5.3" dev=md0 ino=2228931 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_config_t:s0 tclass=file
是/etc/httpd/lib指向其他地方的符号链接吗?通常你不会把你的库放在这里,而只是作为一个符号链接。如果是这样,restorecon -Rv /usr/lib{,64}在这里跑步可能是有益的。
对于下面报告的第二个问题,您需要确保 SELinux 知道您期望 httpd 服务的行为类型。
type=AVC msg=audit(1388121088.955:65): avc: denied { name_connect } for pid=2331 comm="httpd" dest=8080 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_cache_port_t:s0 tclass=tcp_socket
httpd_can_network_relay通过运行启用布尔值setsebool -P httpd_can_network_relay 1。
我不知道该
**** Invalid AVC allowed in current policy ***消息,但我们已经在这里进行了问答
运行您通过audit2allow提供的文本建议
#============= httpd_t ==============
allow httpd_t http_cache_port_t:tcp_socket name_connect;
allow httpd_t httpd_config_t:file execute;
Run Code Online (Sandbox Code Playgroud)
因此您可以尝试使用 grep 将相关的 AVC 拒绝消息提取到临时文件,然后将其传递给audit2allow
grep denied: audit.log | grep httpd >temp.log
cat temp.log | audit2allow -M myHTTPD
******************** IMPORTANT ***********************
To make this policy package active, execute:
semodule -i myHTTPD.pp
Run Code Online (Sandbox Code Playgroud)
安装 myHTTPD.pp 后,您可能仍然会发现 SElinux 阻止 httpd 启动。这是因为早期(现在允许)的否认不再掩盖后来的否认。每次只需重复上述过程即可。