当前位置:   article > 正文

linux开启audit服务器ping通,selinux阻止服务器启动解决方法(需要安装audit2allow)

selinux会影响ping吗

首先开启selinux

[root@345505

log]# sestatus

SELinux

status:                 enabled

SELinuxfs

mount:                /selinux

Current

mode:                   enforcing

Mode

from config file:          enforcing

Policy

version:                 21

Policy

from config file:        targeted

如果被强制暂停,setenforce 1

启动被阻止的服务:

Service httpd start

查看错误日志,tail

/var/log/messages找到selinux阻止服务器启动报错的行

例如:

Nov

15 03:48:21 345505 setroubleshoot: SELinux is preventing the httpd from using

potentially mislabeled files (./mysql). For complete SELinux messages. run

sealert -l 93e363aa-30f2-44f8-b407-78dea459cbfd

运行提示的命令查看selinux阻止的详细信息:

sealert

-l 93e363aa-30f2-44f8-b407-78dea459cbfd

找到倒数第二段落type=AVC的行

例如:

host=345505.mpdedicated.com

type=AVC msg=audit(1321351484.687:2556428): avc:  denied

{ getattr } for  pid=3712

comm="httpd" path="/usr/local/mysql/share/charsets/Index.xml"

dev=sda3 ino=3606930 scontext=root:system_r:httpd_t:s0

tcontext=root:object_r:user_home_t:s0 tclass=file

使用audit2allow生成可以通过selinux的安全策略文件:(echo后面是上面得到的段落)

echo "host=345505.mpdedicated.com type=AVC

msg=audit(1321351484.687:2556428): avc:

denied  { getattr } for  pid=3712 comm="httpd" path="/usr/local/mysql/share/charsets/Index.xml"

dev=sda3 ino=3606930 scontext=root:system_r:httpd_t:s0

tcontext=root:object_r:user_home_t:s0 tclass=file"  |audit2allow-M  httpd

上面的httpd是自定义的名字

这时候会出现提示以下命令:

semodule -ihttpd.pp

运行即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/49587
推荐阅读
相关标签
  

闽ICP备14008679号