more
[mirror/dsa-puppet.git] / modules / exim / manifests / mx.pp
1 class exim::mx inherits exim {
2         include clamav
3         include postgrey
4
5         file { '/etc/exim4/ccTLD.txt':
6                 source => 'puppet:///modules/exim/common/ccTLD.txt',
7         }
8         file { '/etc/exim4/surbl_whitelist.txt':
9                 source => 'puppet:///modules/exim/common/surbl_whitelist.txt',
10         }
11         file { '/etc/exim4/exim_surbl.pl':
12                 source  => 'puppet:///modules/exim/common/exim_surbl.pl',
13                 notify  => Service['exim4'],
14         }
15
16         # 20181010 many connections:
17         #  188.165.219.27
18         #  125.72.232.*
19         #  140.224.61.*
20         #  117.24.36.0/22
21         #  115.235.157.28
22         @ferm::rule { 'dsa-mail-abusers':
23                 prio  => "000",
24                 rule  => "saddr (188.165.219.27 125.72.232.0/24 140.224.61.0/24 117.24.38.0/22 115.235.157.28) DROP",
25         }
26
27         # MXs used as smarthosts
28         @ferm::rule { 'dsa-exim-submission':
29                 description => 'Allow SMTP',
30                 rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_SOURCES)'
31         }
32         @ferm::rule { 'dsa-exim-v6-submission':
33                 description => 'Allow SMTP',
34                 domain      => 'ip6',
35                 rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_V6_SOURCES)',
36         }
37         $autocertdir = hiera('paths.auto_certs_dir')
38         dnsextras::tlsa_record{ "tlsa-submission":
39                 zone => 'debian.org',
40                 certfile => "${autocertdir}/${::fqdn}.crt",
41                 port => 587,
42                 hostname => "$::fqdn",
43         }
44         package { 'nagios-plugins-standard':
45                 ensure => installed,
46         }
47
48         if has_role('mailrelay') {
49                 concat::fragment { 'dsa-puppet-stuff--email-virtualdomains':
50                         target => '/etc/cron.d/dsa-puppet-stuff',
51                         content  => @(EOF)
52                                 @hourly  root if [ ! -d /etc/exim4/email-virtualdomains ]; then cd /etc/exim4 && git clone mail-git:email-virtualdomains ; fi && cd /etc/exim4/email-virtualdomains && git pull --quiet --ff-only
53                                 | EOF
54                 }
55         }
56         file { '/etc/cron.d/dsa-email-virtualdomains': ensure => absent, }
57 }