1

如果布尔值设置为off ,为什么我可以http://localhost/~myusername在 SELinux 设置为 Enforcing 的 Fedora20访问?httpd_enable_homedirs

以下是SELinux 上 fedoraproject 的 wiki 关于布尔httpd_enable_homedirs值的直接摘录:

httpd 默认不允许访问用户主目录。如果您想允许访问用户主目录,您需要设置 httpd_enable_homedirs 布尔值并更改您希望人们从主目录访问的文件的上下文。

/home/user/我在先前版本 (F19) 中设置的目录中有一个目录,用于在服务器 ( /home/user/public_html) 上提供内容/文件,并标有 label httpd_user_content_t。该目录归reg_user:apache; “普通用户”是该apache组的一部分。

但是,根据 SELinux 文档,我假设http://localhost/~reg_user/除非上述布尔值从off切换到on ,否则我将无法访问;然而,在模式下,我可以在没有任何提示/错误的情况下这样做Enforcing。我的假设一开始是否真的有缺陷,或者我的本地 SELinux 策略可能存在安全风险?

顺便说一句:服务器托管在/var/www


疑难解答

将目录的组所有权更改回' 组后,布尔值reg_user的行为没有明显差异。httpd_enable_homedirs但是,我有一个服务器的配置文件,指定了public_html要服务/映射到的目录http://server/~username

<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>

以及<Directory>包含进一步限制/权限和访问控制的块。

也许服务器在这一点上遵循这些指示,而不考虑httpd_enable_homedirs布尔值;在搜索路径权限的初始设置期间主要需要 SELinux 布尔值吗?由于该/home/user/public_html目录标有正确的fcontext(即httpd_user_content_t),这是我能想到的唯一解释为什么 SELinux 不阻止 apache 访问它。


SELinux 策略模块

为了缩小这种不一致的可能原因,我发出了以下命令(正如用户 @FeRD 所建议的那样),其中列出了自定义/不规则 SELinux 策略文件,这些文件不是由selinux-policy-targeted软件包提供/拥有的:

[root@hostname etc]# find /etc/selinux -print0 |xargs -0 -n10 rpm -qf |grep "not owned"
file /etc/selinux/targeted/modules/active/booleans.local is not owned by any package
file /etc/selinux/targeted/modules/active/modules/sandbox.pp.disabled is not owned by any package
file /etc/selinux/targeted/modules/active/modules/sandbox.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/radicale.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/permissive_bluetooth_t.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/mod_selinux.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/mypol.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/gcl.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/copr.pp is not owned by any package
file /etc/selinux/targeted/modules/active/modules/mailgraph.pp is not owned by any package
file /etc/selinux/targeted/modules/active/ports.local is not owned by any package
file /etc/selinux/targeted/contexts/netfilter_contexts is not owned by any package
4

0 回答 0