most of the mta firewalling is not exim specific
authorPeter Palfrader <peter@palfrader.org>
Sat, 21 Sep 2019 22:27:05 +0000 (00:27 +0200)
committerPeter Palfrader <peter@palfrader.org>
Sat, 21 Sep 2019 22:27:05 +0000 (00:27 +0200)
modules/roles/manifests/mta.pp

index c184f96..c70224d 100644 (file)
@@ -11,34 +11,10 @@ class roles::mta(
   if $type == 'exim4' {
     if $mailrelay {
       include roles::mailrelay
+    } elsif $heavy {
+      include exim::mx
     } else {
-      if $heavy {
-        include exim::mx
-      } else {
-        include exim
-      }
-
-      $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
-      if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } {
-        $mailport = lookup( { 'name' => 'exim::mail_port', 'default_value' => undef } )
-
-
-        @@concat::fragment { "manualroute-to-${::fqdn}":
-          tag     => 'exim::manualroute::to::mailrelay',
-          target  => '/etc/exim4/manualroute-new',
-          content => $mailport == undef ? {
-            true    => "${::fqdn}:   ${::fqdn}",
-            default => "${::fqdn}:   ${::fqdn}::${mailport}",
-          }
-        }
-
-        Ferm::Rule::Simple <<| tag == 'smtp::server::from::mailrelay' |>> {
-          port => $mailport == undef ? {
-            true    => 25,
-            default => $mailport,
-          }
-        }
-      }
+      include exim
     }
   } elsif $type == 'postfix' {
     if $mailrelay {
@@ -48,4 +24,26 @@ class roles::mta(
   } else {
     fail("Unexpected mta type ${type}")
   }
+
+
+  $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
+  if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } {
+    $mailport = lookup( { 'name' => 'exim::mail_port', 'default_value' => undef } )
+
+    @@concat::fragment { "manualroute-to-${::fqdn}":
+      tag     => 'exim::manualroute::to::mailrelay',
+      target  => '/etc/exim4/manualroute-new',
+      content => $mailport == undef ? {
+        true    => "${::fqdn}:   ${::fqdn}",
+        default => "${::fqdn}:   ${::fqdn}::${mailport}",
+      }
+    }
+
+    Ferm::Rule::Simple <<| tag == 'smtp::server::from::mailrelay' |>> {
+      port => $mailport == undef ? {
+        true    => 25,
+        default => $mailport,
+      }
+    }
+  }
 }