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         #  113.110.47.180
23         #  121.226.141.*
24         @ferm::rule { 'dsa-mail-abusers':
25                 prio  => "000",
26                 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 113.110.47.180 121.226.141.0/24) DROP",
27         }
28
29         # MXs used as smarthosts
30         @ferm::rule { 'dsa-exim-submission':
31                 description => 'Allow SMTP',
32                 rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_SOURCES)'
33         }
34         @ferm::rule { 'dsa-exim-v6-submission':
35                 description => 'Allow SMTP',
36                 domain      => 'ip6',
37                 rule        => '&SERVICE_RANGE(tcp, submission, $SMTP_V6_SOURCES)',
38         }
39         $autocertdir = hiera('paths.auto_certs_dir')
40         dnsextras::tlsa_record{ "tlsa-submission":
41                 zone => 'debian.org',
42                 certfile => "${autocertdir}/${::fqdn}.crt",
43                 port => 587,
44                 hostname => "$::fqdn",
45         }
46         package { 'nagios-plugins-standard':
47                 ensure => installed,
48         }
49
50         if has_role('mailrelay') {
51                 concat::fragment { 'dsa-puppet-stuff--email-virtualdomains':
52                         target => '/etc/cron.d/dsa-puppet-stuff',
53                         content  => @(EOF)
54                                 @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
55                                 | EOF
56                 }
57         }
58         file { '/etc/cron.d/dsa-email-virtualdomains': ensure => absent, }
59 }