split out some exim::mx config into a new exim::mailrelay
[mirror/dsa-puppet.git] / modules / exim / manifests / mx.pp
index 3c40623..0157b14 100644 (file)
@@ -1,35 +1,46 @@
-class exim::mx inherits exim {
-       include clamav
-       include postgrey
+# our heavy exim class
+# @param is_mailrelay this system is a mailrelay, both in and out, for debian hosts
+class exim::mx(
+  Boolean $is_mailrelay = false,
+){
+  class { 'exim':
+    use_smarthost => false,
+    is_mailrelay  => $is_mailrelay,
+  }
 
-       file { '/etc/exim4/ccTLD.txt':
-               source => 'puppet:///modules/exim/common/ccTLD.txt',
-       }
-       file { '/etc/exim4/surbl_whitelist.txt':
-               source => 'puppet:///modules/exim/common/surbl_whitelist.txt',
-       }
-       file { '/etc/exim4/exim_surbl.pl':
-               source  => 'puppet:///modules/exim/common/exim_surbl.pl',
-               notify  => Service['exim4'],
-       }
+  include clamav
+  include postgrey
+  include fail2ban::exim
 
-       # MXs used as smarthosts
-       @ferm::rule { 'dsa-exim-submission':
-               description => 'Allow SMTP',
-               rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_SOURCES)'
-       }
-       @ferm::rule { 'dsa-exim-v6-submission':
-               description => 'Allow SMTP',
-               domain      => 'ip6',
-               rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_V6_SOURCES)',
-       }
-       dnsextras::entry{ "tlsa-submission":
-               zone => 'debian.org',
-               label => "_587._tcp.${::fqdn}",
-               rrtype => 'TXT',
-               rrdata => 'testing' }
+  file { '/etc/exim4/ccTLD.txt':
+    source => 'puppet:///modules/exim/common/ccTLD.txt',
+  }
+  file { '/etc/exim4/surbl_whitelist.txt':
+    source => 'puppet:///modules/exim/common/surbl_whitelist.txt',
+  }
+  file { '/etc/exim4/exim_surbl.pl':
+    source => 'puppet:///modules/exim/common/exim_surbl.pl',
+    notify => Service['exim4'],
+  }
 
-       package { 'nagios-plugins-standard':
-               ensure => installed,
-       }
+  # MXs used as smarthosts
+  ferm::rule { 'dsa-exim-submission':
+    description => 'Allow SMTP',
+    rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_SOURCES)'
+  }
+  ferm::rule { 'dsa-exim-v6-submission':
+    description => 'Allow SMTP',
+    domain      => 'ip6',
+    rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_V6_SOURCES)',
+  }
+  $autocertdir = hiera('paths.auto_certs_dir')
+  dnsextras::tlsa_record{ 'tlsa-submission':
+    zone     => 'debian.org',
+    certfile => "${autocertdir}/${::fqdn}.crt",
+    port     => 587,
+    hostname => $::fqdn,
+  }
+  package { 'monitoring-plugins-standard':
+    ensure => installed,
+  }
 }