赞
踩
首先开启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
运行即可
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。