]> gitweb.fluxo.info Git - puppet-postfix.git/commitdiff
postfix: selinux labels differ from one distribution to another
authorMarc Fournier <marc.fournier@camptocamp.com>
Fri, 28 Aug 2009 07:15:19 +0000 (09:15 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Fri, 28 Aug 2009 07:15:19 +0000 (09:15 +0200)
manifests/classes/postfix.pp
manifests/definitions/hash.pp

index bf1b8f81c51389614d0b0a99dc05d0be95fae47c..d79199eef633cf2ec9d1f33520d6aa20080816b3 100644 (file)
@@ -6,6 +6,21 @@
 
 class postfix {
 
+  case $operatingsystem {
+
+    RedHat: {
+      case $lsbmajdistrelease {
+        "4":     { $postfix_seltype = "etc_t" }
+        "5":     { $postfix_seltype = "postfix_etc_t" }
+        default: { $postfix_seltype = undef }
+      }
+    }
+
+    default: {
+      $postfix_seltype = undef
+    }
+  }
+
   # Default value for various options
   case $postfix_ng_smtp_listen {
     "": { $postfix_ng_smtp_listen = "127.0.0.1" }
@@ -27,7 +42,7 @@ class postfix {
   file { "/etc/mailname":
     ensure  => present,
     content => "${fqdn}\n",
-    seltype => "postfix_etc_t",
+    seltype => $postfix_seltype,
   }
 
   # Aliases
@@ -36,7 +51,7 @@ class postfix {
     ensure => present,
     content => "# file managed by puppet\n",
     replace => false,
-    seltype => "postfix_etc_t",
+    seltype => $postfix_seltype,
     notify => Exec["newaliases"],
   }
 
@@ -57,6 +72,7 @@ class postfix {
       Redhat => template("postfix/master.cf.redhat5.erb"),
       Debian => template("postfix/master.cf.debian-etch.erb"),
     },
+    seltype => $postfix_seltype,
     notify  => Service["postfix"],
     require => Package["postfix"],
   }
@@ -67,6 +83,7 @@ class postfix {
     mode => "0644",
     source  => "puppet:///postfix/main.cf",
     replace => false,
+    seltype => $postfix_seltype,
     notify  => Service["postfix"],
     require => Package["postfix"],
   }
index 2ecbff8170ef515051889b6e8b8074d44c036c26..e012458c4af326f29d3b339298d3e50149ebb0b4 100644 (file)
@@ -1,8 +1,24 @@
 define postfix::hash ($ensure) {
+
+  case $operatingsystem {
+
+    RedHat: {
+      case $lsbmajdistrelease {
+        "4":     { $postfix_seltype = "etc_t" }
+        "5":     { $postfix_seltype = "postfix_etc_t" }
+        default: { $postfix_seltype = undef }
+      }
+    }
+
+    default: {
+      $postfix_seltype = undef
+    }
+  }
+
   file {"${name}":
     ensure => $ensure,
     mode   => 600,
-    seltype => "postfix_etc_t",
+    seltype => $postfix_seltype,
     require => Package["postfix"],
   }
 
@@ -10,7 +26,7 @@ define postfix::hash ($ensure) {
     ensure  => $ensure,
     mode    => 600,
     require => [File["${name}"], Exec["generate ${name}.db"]],
-    seltype => "postfix_etc_t",
+    seltype => $postfix_seltype,
   }
 
   exec {"generate ${name}.db":