changeset 48:5cdc1c96c477 puppet-3.6

Add SELinux support for website content
author IBBoard <dev@ibboard.co.uk>
date Sat, 25 Jul 2015 17:10:35 +0100
parents a82c271fb26a
children 30f56d6f9d33
files manifests/templates.pp modules/website/manifests/init.pp
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/manifests/templates.pp	Sat Jul 25 11:48:42 2015 +0100
+++ b/manifests/templates.pp	Sat Jul 25 17:10:35 2015 +0100
@@ -315,6 +315,8 @@
 	if $operatingsystem == 'CentOS' and versioncmp($operatingsystemrelease, 7) >= 0 {
 		$mysqlpackage = 'mariadb'
 		$mysqlsuffix = ''
+
+		package { 'policycoreutils-python': ensure => installed }
 	}
 	else {
 		$mysqlpackage = 'mysql'
--- a/modules/website/manifests/init.pp	Sat Jul 25 11:48:42 2015 +0100
+++ b/modules/website/manifests/init.pp	Sat Jul 25 17:10:35 2015 +0100
@@ -81,4 +81,12 @@
   file { $cert_dir:
     ensure => directory;
   }
+  if $operatingsystem == 'CentOS' and versioncmp($operatingsystemrelease, 7) >= 0 {
+    exec { 'set_apache_defaults':
+      command => 'semanage fcontext -a -t httpd_sys_content_t "/srv/sites(/.*)?"',
+      path    => '/bin:/usr/bin/:/sbin:/usr/sbin',
+      require => Package['policycoreutils-python'],
+      unless  => 'semanage fcontext --list | grep "/srv/sites\\(/\\.\\*\\)\\?"',
+    }
+  }
 }