Amazon ec2 启用selinux时无法从web浏览器访问nfs文件

Amazon ec2 启用selinux时无法从web浏览器访问nfs文件,amazon-ec2,centos,selinux,Amazon Ec2,Centos,Selinux,当禁用selinux时,我能够从我的amazon ec2 centos实例上的nfs装载卷访问html页面。但当我启用它时,我得到“无法连接”错误。我已经启用了httpd_use_nfs和其他相关的布尔策略,但仍然收到相同的错误。请帮助我解决此问题。我需要apache在启用SELinux的情况下访问我的网页。如何检查问题是否由SELinux生成: setenforce 0 # if it works after this command : Selinux is the problem sete

当禁用selinux时,我能够从我的amazon ec2 centos实例上的nfs装载卷访问html页面。但当我启用它时,我得到“无法连接”错误。我已经启用了httpd_use_nfs和其他相关的布尔策略,但仍然收到相同的错误。请帮助我解决此问题。我需要apache在启用SELinux的情况下访问我的网页。

如何检查问题是否由SELinux生成:

setenforce 0 # if it works after this command : Selinux is the problem
setenforce 1 # re-enable selinux because you are not crazy
# install setroubleshoot (here for centos7)
yum install setroubleshoot
#audit
tail -f /var/log/messages | grep sealert 
如何解决selinux的问题:

setenforce 0 # if it works after this command : Selinux is the problem
setenforce 1 # re-enable selinux because you are not crazy
# install setroubleshoot (here for centos7)
yum install setroubleshoot
#audit
tail -f /var/log/messages | grep sealert 
阅读最后一条消息,您可以执行建议用于解决问题的命令

一般来说,在完成后,问题就解决了


SeLinux很简单…有时…;-)

您位于/var/log/audit/audit.log的auditlog中有什么?感谢您的响应。这是audit.log的一部分感谢您的响应。这是audit.log中与httpd相关的一部分。type=AVC msg=audit(1392816609.757:94):AVC:denied{getattr}for pid=6424 comm=“httpd”path=“/home/testman”dev=0:13 ino=393960 scontext=unconfined\u:system\u r:httpd\u t:s0 tcontext=system\u:object\u r:nfs\u t:s0 tclass=dir./home/testman是挂载点。请原谅我的无知,我需要查看日志文件中的其他内容吗?好吧,默认情况下httpd无法访问主目录,请查看如何启用。但是,我不建议以这种方式访问主目录。如果可能的话,最好装载到另一个装载点并对其进行标记。或者看看,如何访问“谢谢”中描述的标签目录。我们将查看这些链接。