I'm having some issues changing directory permissions that LOOK like they're related to SELinux. I'm trying to figure out how to disable SELinux a) for the remainder of the chef-client session and b) permanently.
Resource:
# Change permissions for mounted repository
directory "/home/analytics" do
owner "analytics"
mode "711"
end
Error:
/sbin/restorecon set context /analytics/file failed:'Operation not supported'
Environment:
- Test Kitchen, Vagrant driver, and VirtualBox.
- Box - Chef provisionerless centos-5.10.
Looks like SELinux is mucking up the works. Great. Let's disable SELinux!
The stock config from Chef's box is set to permissive.
[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
I can template the config and set to disabled, but that will only apply after reboot. Usually disabling SELinux in the current session is done via the CLI (sestatus, setenforce, etc). Our cookbooks (and the official one) rely on this functionality. But it appears to be broken here...
[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
So how do I disable SELinux without rebooting the box or running Chef twice?