Commit 77730dfede7fb2c19c1fc9545059a44712272d72

Authored by Macartur Sousa
1 parent 677ccf51

Added nginx permission to write files *.error.log

Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
cookbooks/basics/files/default/nginx.te 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +
  2 +module nginx_integration 1.0;
  3 +
  4 +require {
  5 + type httpd_log_t;
  6 + type httpd_t;
  7 + class file setattr;
  8 +}
  9 +
  10 +#============= httpd_t ==============
  11 +allow httpd_t httpd_log_t:file setattr;
cookbooks/basics/recipes/nginx.rb
@@ -4,3 +4,15 @@ service &#39;nginx&#39; do @@ -4,3 +4,15 @@ service &#39;nginx&#39; do
4 action :enable 4 action :enable
5 supports :restart => true 5 supports :restart => true
6 end 6 end
  7 +
  8 +################################
  9 +# SELinux: allow nginx to use log files
  10 +################################
  11 +cookbook_file '/etc/selinux/local/nginx.te' do
  12 + notifies :run, 'execute[selinux-nginx]'
  13 +end
  14 +
  15 +execute 'selinux-nginx' do
  16 + command 'selinux-install-module /etc/selinux/local/nginx.te'
  17 + action :nothing
  18 +end