【发布时间】:2015-02-04 16:39:20
【问题描述】:
我在更改看起来与 SELinux 相关的目录权限时遇到了一些问题。我正在尝试弄清楚如何在厨师客户端会话的剩余部分中禁用 SELinux a) 以及 b) 永久禁用。
资源:
# Change permissions for mounted repository
directory "/home/analytics" do
owner "analytics"
mode "711"
end
错误:
/sbin/restorecon set context /analytics/file failed:'Operation not supported'
环境:
- 测试 Kitchen、Vagrant 驱动程序和 VirtualBox。
- 盒子 - Chef provisionerless centos-5.10.
看起来 SELinux 搞砸了。伟大的。让我们禁用 SELinux!
Chef's box 中的库存配置设置为许可。
[root@analytics selinux]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
我可以将配置模板化并设置为禁用,但这只会在重新启动后应用。通常在当前会话中禁用 SELinux 是通过 CLI(sestatus、setenforce 等)完成的。我们的食谱(和the official one)依赖于这个功能。不过这里好像坏了……
[root@analytics selinux]# sestatus
bash: sestatus: command not found
[root@analytics selinux]# getstatus
bash: getstatus: command not found
[root@analytics selinux]# rpm -q policycoreutils
policycoreutils-1.33.12-14.13.el5
那么如何在不重启机器或运行 Chef 两次的情况下禁用 SELinux?
【问题讨论】:
-
sestatus 和 getenforce 在 '/usr/sbin' 目录中,所以尝试使用绝对路径调用它们。如果找不到,请尝试重新安装 policycoreutils 包。
-
谢谢!我在 /sbin 中寻找这些。我的错。
[vagrant@analytics-centos-510 sbin]$ ls /usr/sbin/se* /usr/sbin/selinuxenabled /usr/sbin/semodule /usr/sbin/sestatus /usr/sbin/semanage /usr/sbin/setenforce
标签: chef-infra centos5 selinux test-kitchen