X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Fmanifests%2Fmta.pp;h=b985cd03a17c6fcf0fb0c04edacecea1a94c1aac;hb=0421e66cccaa222db2aa846185cee2be121d694a;hp=3ce44436a4dfa1e026e4e9415a3385004a5fdcc8;hpb=1f37c1198a12c740639535f69d3f42b841c0aca5;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/manifests/mta.pp b/modules/roles/manifests/mta.pp index 3ce44436a..b985cd03a 100644 --- a/modules/roles/manifests/mta.pp +++ b/modules/roles/manifests/mta.pp @@ -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 {