On hosts that get mail via mailrelays, try to collect the ferm rule that will allow...
[mirror/dsa-puppet.git] / modules / roles / manifests / mta.pp
index 3ce4443..b985cd0 100644 (file)
@@ -11,10 +11,31 @@ class roles::mta(
   if $type == 'exim4' {
     if $mailrelay {
       include roles::mailrelay
-    } elsif $heavy {
-      include exim::mx
     } else {
-      include exim
+      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
+        }
+      }
     }
   } elsif $type == 'postfix' {
     if $mailrelay {