X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Fmanifests%2Fmta.pp;h=2c0ca4eebb03afaac05b6da032a44f12411ae7f0;hb=3a403df3e4f5c89ec1b1893396dfdd3c37e3bb7a;hp=c184f968d8cd2b5b7557b035e461adc88738117c;hpb=623a535ff7b70ac98e56551378eacf39da65e0cf;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/manifests/mta.pp b/modules/roles/manifests/mta.pp index c184f968d..2c0ca4eeb 100644 --- a/modules/roles/manifests/mta.pp +++ b/modules/roles/manifests/mta.pp @@ -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,34 @@ 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', + 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, + } + } + } else { + if ! defined(Class['exim::mx']) and ! defined(Class['postfix']) { + fail('We are not an exim::mx (or a postfix) yet do not have set our MXs to INCOMING-MX.') + } + ferm::rule::simple { 'dsa-smtp': + description => 'Allow smtp access from the world', + port => '25', + } + } }