httpd
httpd copied to clipboard
Changing file permissions for httpd directories
Cookbook version
0.5.0
Chef-client version
chef-client version: 12.18.31
Platform Details
Centos 6
Scenario:
Due to security we would like the ability to change the default directory permissions from root to apache.
Steps to Reproduce:
httpd_service node['httpd']['http_service_name'] do
action [:create, :start]
mpm 'prefork'
not_if { ::File.directory?("/etc/httpd-#{node['httpd']['http_service_name']}/conf.d")}
end
#httpd config file
httpd_config node['httpd']['http_service_name'] do
instance node['httpd']['http_service_name']
source (node['httpd']['enable_ssl'] ? 'httpd_ssl.conf.erb' : 'httpd.conf.erb')
variables ({
server_name: node['httpd']['server']
})
action :create
notifies :restart, "httpd_service[#{node['httpd']['http_service_name']}]"
end
Expected Result:
Being able to change the group and user permissions. Changing the file permissions to 750.
[root@ej httpd]# ls -al
drwxr-x---. 2 apache apache 4096 Sep 28 14:09 conf
drwxr-x---. 2 apache apache 4096 Sep 28 14:11 conf.d
Actual Result:
[root@ej httpd]# ls -al
drwxr-xr-x. 2 root root 4096 Sep 28 14:09 conf
drwxr-xr-x. 2 root root 4096 Sep 28 14:11 conf.d