【问题标题】:unable to access nfs files from web browser when selinux is enables启用 selinux 时无法从 Web 浏览器访问 nfs 文件
【发布时间】:2014-03-22 13:07:28
【问题描述】:

当 selinux 被禁用时,我可以从我的 amazon ec2 centos 实例上的 nfs 挂载卷访问 html 页面。但是当我启用它时,我得到“无法连接”错误。我已启用 httpd_use_nfs 和其他相关的布尔策略,但仍然遇到相同的错误。请帮我解决问题。我需要 apache 来使用 SELinux On 访问我的网页。

【问题讨论】:

  • /var/log/audit/audit.log 的审计日志中有什么内容?
  • 感谢您的回复。这是 audit.log 的一部分
  • 感谢您的响应。这里是与 httpd.type=AVC msg=audit(1392816609.757:94) 相关的一部分 audit.log:avc: denied { getattr } for pid=6424 comm=" httpd" path="/home/testman" dev=0:13 ino=393960 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=dir./home/testman 是挂载点。原谅我的无知,我还需要查看日志文件中的其他内容吗?
  • 嗯,httpd默认是无法访问home目录的,请看stackoverflow.com/questions/21566234/…如何开启。但是,我不建议以这种方式访问​​主目录。如果可能的话,宁愿挂载到另一个挂载点并贴上标签。或者看看,如何访问stackoverflow.com/questions/15795410/…中描述的标签目录
  • 谢谢。将查看链接。

标签: amazon-ec2 centos selinux


【解决方案1】:

如何检查问题是否是由selinux产生的:

setenforce 0 # if it works after this command : Selinux is the problem
setenforce 1 # re-enable selinux because you are not crazy

如何解决selinux的问题:

# install setroubleshoot (here for centos7)
yum install setroubleshoot
#audit
tail -f /var/log/messages | grep sealert 

阅读最后一条消息,您可以执行建议的命令来解决您的问题。

一般情况下,问题就解决了。

SeLinux 很简单...有时... ;-)

【讨论】:

    猜你喜欢
    • 2019-01-19
    • 2014-05-14
    • 1970-01-01
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 2018-04-01
    • 1970-01-01
    • 2022-12-04
    相关资源
    最近更新 更多