1 # Every one of our hosts has an MTA
3 # @param type exim4 or postfix. exim4 is our default MTA
4 # @param heavy receive email from the internet and thus do spam filtering etc
5 # @param mailrelay receive mail on other hosts' behalf. implies heavy
7 Enum['exim4', 'postfix'] $type = 'exim4',
8 Boolean $heavy = false,
9 Boolean $mailrelay = false,
13 include roles::mailrelay
19 } elsif $type == 'postfix' {
21 fail("Unsupported: mailrelay on type ${type}")
25 fail("Unexpected mta type ${type}")
29 $mxdata = dig($deprecated::nodeinfo, 'ldap', 'mXRecord')
30 if $mxdata and $mxdata.any |$item| { $item =~ /INCOMING-MX/ } {
31 $mailport = lookup( { 'name' => 'exim::mail_port', 'default_value' => undef } )
33 @@concat::fragment { "manualroute-to-${::fqdn}":
34 tag => 'exim::manualroute::to::mailrelay',
35 target => '/etc/exim4/manualroute',
36 content => $mailport == undef ? {
37 true => "${::fqdn}: ${::fqdn}",
38 default => "${::fqdn}: ${::fqdn}::${mailport}",
42 Ferm::Rule::Simple <<| tag == 'smtp::server::from::mailrelay' |>> {
43 port => $mailport == undef ? {