9f362243fc08e28f3f6b7bde38c1e2b66c3bd804
[mirror/dsa-puppet.git] / modules / exim / manifests / init.pp
1 class exim {
2
3         include exim::vdomain::setup
4
5         munin::check { 'ps_exim4': script => 'ps_' }
6         munin::check { 'exim_mailqueue': }
7         munin::check { 'exim_mailstats': }
8
9         munin::check { 'postfix_mailqueue':  ensure => absent }
10         munin::check { 'postfix_mailstats':  ensure => absent }
11         munin::check { 'postfix_mailvolume': ensure => absent }
12
13         package { 'exim4-daemon-heavy': ensure => installed }
14
15         Package['exim4-daemon-heavy']->Mailalias<| |>
16
17         concat::fragment { 'virtual_domain_template':
18                 target  => '/etc/exim4/virtualdomains',
19                 content => template('exim/virtualdomains.erb'),
20                 order   => 05,
21         }
22
23         service { 'exim4':
24                 ensure  => running,
25                 require => [
26                         File['/etc/exim4/exim4.conf'],
27                         Package['exim4-daemon-heavy'],
28                 ]
29         }
30
31         file { '/etc/exim4/':
32                 ensure  => directory,
33                 mode    => '0755',
34                 require => Package['exim4-daemon-heavy'],
35                 purge   => true,
36         }
37         file { '/etc/exim4/Git':
38                 ensure  => absent,
39                 force   => true,
40         }
41         # git checkouts through puppet.  yummy.
42         file { '/etc/exim4/email-virtualdomains':
43                 recurse => true,
44                 source => 'puppet:///modules/exim/email-virtualdomains',
45                 purge  => true,
46                 ignore => '.git',
47         }
48         file { '/etc/exim4/conf.d':
49                 ensure  => directory,
50                 purge   => true,
51                 force   => true,
52                 recurse => true,
53                 source  => 'puppet:///files/empty/',
54         }
55         file { '/etc/exim4/ssl':
56                 ensure  => directory,
57                 group   => Debian-exim,
58                 mode    => '0750',
59                 purge   => true,
60         }
61         file { '/etc/exim4/exim4.conf':
62                 content => template('exim/eximconf.erb'),
63                 require => File['/etc/exim4/ssl/thishost.crt'],
64                 notify  => Service['exim4'],
65         }
66         file { '/etc/mailname':
67                 content => template('exim/mailname.erb'),
68         }
69         file { '/etc/exim4/manualroute':
70                 content => template('exim/manualroute.erb')
71         }
72         file { '/etc/exim4/locals':
73                 content => template('exim/locals.erb')
74         }
75         file { '/etc/exim4/submission-domains':
76                 content => template('exim/submission-domains.erb'),
77         }
78         file { '/etc/exim4/host_blacklist':
79                 source => 'puppet:///modules/exim/common/host_blacklist',
80         }
81         file { '/etc/exim4/blacklist':
82                 source => 'puppet:///modules/exim/common/blacklist',
83         }
84         file { '/etc/exim4/callout_users':
85                 source => 'puppet:///modules/exim/common/callout_users',
86         }
87         file { '/etc/exim4/grey_users':
88                 source => 'puppet:///modules/exim/common/grey_users',
89         }
90         file { '/etc/exim4/helo-check':
91                 source => 'puppet:///modules/exim/common/helo-check',
92         }
93         file { '/etc/exim4/localusers':
94                 source => 'puppet:///modules/exim/common/localusers',
95         }
96         file { '/etc/exim4/rbllist':
97                 source => 'puppet:///modules/exim/common/rbllist',
98         }
99         file { '/etc/exim4/rhsbllist':
100                 source => 'puppet:///modules/exim/common/rhsbllist',
101         }
102         file { '/etc/exim4/whitelist':
103                 source => 'puppet:///modules/exim/common/whitelist',
104         }
105         file { '/etc/logrotate.d/exim4-base':
106                 source => 'puppet:///modules/exim/common/logrotate-exim4-base',
107         }
108         file { '/etc/logrotate.d/exim4-paniclog':
109                 source => 'puppet:///modules/exim/common/logrotate-exim4-paniclog'
110         }
111         file { '/etc/exim4/ssl/thishost.crt':
112                 source  => "puppet:///modules/exim/certs/${::fqdn}.crt",
113                 group   => Debian-exim,
114                 mode    => '0640',
115         }
116         file { '/etc/exim4/ssl/thishost.key':
117                 source  => "puppet:///modules/exim/certs/${::fqdn}.key",
118                 group   => Debian-exim,
119                 mode    => '0640',
120         }
121         file { '/etc/exim4/ssl/ca.crt':
122                 source  => 'puppet:///modules/exim/certs/ca.crt',
123                 group   => Debian-exim,
124                 mode    => '0640',
125         }
126         file { '/etc/exim4/ssl/ca.crl':
127                 source  => 'puppet:///modules/exim/certs/ca.crl',
128                 group   => Debian-exim,
129                 mode    => '0640',
130         }
131         file { '/var/log/exim4':
132                 ensure  => directory,
133                 mode    => '2750',
134                 owner   => Debian-exim,
135                 group   => maillog,
136         }
137
138         case getfromhash($site::nodeinfo, 'mail_port') {
139                 /^(\d+)$/: { $mail_port = $1 }
140                 default: { $mail_port = '25' }
141         }
142
143         @ferm::rule { 'dsa-exim':
144                 description => 'Allow SMTP',
145                 rule        => "&SERVICE_RANGE(tcp, $mail_port, \$SMTP_SOURCES)"
146         }
147
148         @ferm::rule { 'dsa-exim-v6':
149                 description => 'Allow SMTP',
150                 domain      => 'ip6',
151                 rule        => "&SERVICE_RANGE(tcp, $mail_port, \$SMTP_V6_SOURCES)"
152         }
153         dnsextras::tlsa_record{ 'tlsa-mailport':
154                 zone     => 'debian.org',
155                 certfile => "/etc/puppet/modules/exim/files/certs/${::fqdn}.crt",
156                 port     => $mail_port,
157                 hostname => $::fqdn,
158         }
159
160         # Do we actually want this?  I'm only doing it because it's harmless
161         # and makes the logs quiet.  There are better ways of making logs quiet,
162         # though.
163         @ferm::rule { 'dsa-ident':
164                 domain      => '(ip ip6)',
165                 description => 'Allow ident access',
166                 rule        => '&SERVICE(tcp, 113)'
167         }
168
169         # These only affect the alias @$fqdn, not say, @debian.org
170
171         mailalias { [
172                 'postmaster',
173                 'hostmaster',
174                 'usenet',
175                 'webmaster',
176                 'abuse',
177                 'noc',
178                 'security',
179         ]:
180                 ensure => absent
181         }
182 }