diff modules/postfix/manifests/init.pp @ 390:df5ad1612af7

Adapt configs to support Ubuntu This is prep for running a VPS on a Mythic Beasts Raspberry Pi * Switch paths where necessary * Add optional modules that only apply on some OSes * Change usernames and groups * Don't do RPM-based stuff in Ubuntu * Switch to using some of the new modules
author IBBoard <dev@ibboard.co.uk>
date Mon, 03 Jan 2022 18:37:16 +0000
parents a4867ea13d84
children 2c3e745be8d2
line wrap: on
line diff
--- a/modules/postfix/manifests/init.pp	Mon Jan 03 17:16:21 2022 +0000
+++ b/modules/postfix/manifests/init.pp	Mon Jan 03 18:37:16 2022 +0000
@@ -65,7 +65,7 @@
   }
 
   exec { 'postmap-files':
-    command     => 'for file in helo_whitelist recipient_bcc sender_access valias valias-blacklist virtual vmailbox transport; do postmap $file; done',
+    command     => 'for file in helo_whitelist recipient_bcc sender_access valias valias-blacklist virtual vmailbox; do postmap $file; done',
     cwd         => '/etc/postfix/',
     provider    => 'shell',
     refreshonly => true,
@@ -76,6 +76,12 @@
     notify  => Exec['postmap-files'],
     require => Package['postfix'],
   }
+  if $osfamily == 'RedHat' {
+    $policyd_script = '/usr/libexec/postfix/policyd-spf'
+  }
+  elsif $osfamily == 'Debian' {
+    $policyd_script = '/usr/bin/policyd-spf'
+  }
   file { '/etc/postfix/main.cf':
     content => epp('postfix/main.cf.epp',
                    {
@@ -93,6 +99,7 @@
                      'mailserver_proxy' => $mailserver_proxy,
                      'lo_ip' => $lo_ip,
                      'lo_networks' => $lo_networks,
+                     'policyd_script' => $policyd_script,
                      'fallback_relays' => $mailrelays,
                    }
                   ),
@@ -172,11 +179,19 @@
   } 
 
   #SPF checking
-  package { 'pypolicyd-spf':
+  if $osfamily == 'RedHat' {
+    $pypolicyd_package = 'pypolicyd-spf'
+    $pypolicyd_config = '/etc/python-policyd-spf/policyd-spf.conf'
+  }
+  elsif $osfamily == 'Debian' {
+    $pypolicyd_package = 'postfix-policyd-spf-python'
+    $pypolicyd_config = '/etc/postfix-policyd-spf-python/policyd-spf.conf'
+  }
+  package { $pypolicyd_package:
     ensure => installed;
   }
   ->
-  file { '/etc/python-policyd-spf/policyd-spf.conf':
+  file { $pypolicyd_config:
     content => epp('postfix/policyd-spf.conf',
                    {
                      'fallback_relays' => $mailrelays,