class exim::mx inherits exim {
- include clamav
- include postgrey
- include fail2ban::exim
+ include clamav
+ include postgrey
+ include fail2ban::exim
- 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'],
- }
+ 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'],
+ }
- # 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,
- }
+ # 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,
+ }
- if $exim::is_mailrelay {
- concat::fragment { 'puppet-crontab--email-virtualdomains':
- target => '/etc/cron.d/puppet-crontab',
- content => @(EOF)
- @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
- | EOF
- }
- }
- file { '/etc/cron.d/dsa-email-virtualdomains': ensure => absent, }
+ if $exim::is_mailrelay {
+ concat::fragment { 'puppet-crontab--email-virtualdomains':
+ target => '/etc/cron.d/puppet-crontab',
+ content => @(EOF)
+ @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
+ | EOF
+ }
+ }
+ file { '/etc/cron.d/dsa-email-virtualdomains': ensure => absent, }
}
define exim::vdomain (
- $alias_file,
- $user,
- $group,
- $maildir="/srv/${name}",
- $domain=$name,
+ $alias_file,
+ $user,
+ $group,
+ $maildir="/srv/${name}",
+ $domain=$name,
) {
- include exim::vdomain::setup
+ include exim::vdomain::setup
- file { $maildir:
- ensure => directory,
- mode => '0755',
- owner => root,
- group => root
- }
+ file { $maildir:
+ ensure => directory,
+ mode => '0755',
+ owner => root,
+ group => root
+ }
- file { "${maildir}/mail":
- ensure => directory,
- mode => '0755',
- owner => root,
- group => root
- }
+ file { "${maildir}/mail":
+ ensure => directory,
+ mode => '0755',
+ owner => root,
+ group => root
+ }
- file { "${maildir}/mail/aliases":
- source => $alias_file,
- mode => '0644',
- owner => root,
- group => root
- }
+ file { "${maildir}/mail/aliases":
+ source => $alias_file,
+ mode => '0644',
+ owner => root,
+ group => root
+ }
- concat::fragment { "virtualdomain_${domain}":
- target => '/etc/exim4/virtualdomains',
- content => "${domain}: user=${user} group=${group} directory=${maildir}/mail\n",
- }
+ concat::fragment { "virtualdomain_${domain}":
+ target => '/etc/exim4/virtualdomains',
+ content => "${domain}: user=${user} group=${group} directory=${maildir}/mail\n",
+ }
}
class exim::vdomain::setup {
+ concat { '/etc/exim4/virtualdomains':
+ owner => root,
+ group => root,
+ mode => '0644',
+ require => Package['exim4-daemon-heavy']
+ }
- concat { '/etc/exim4/virtualdomains':
- owner => root,
- group => root,
- mode => '0644',
- require => Package['exim4-daemon-heavy']
- }
-
- concat::fragment { 'virtualdomains_header':
- target => '/etc/exim4/virtualdomains',
- content => template('exim/virtualdomains.header.erb'),
- order => '00',
- }
+ concat::fragment { 'virtualdomains_header':
+ target => '/etc/exim4/virtualdomains',
+ content => template('exim/virtualdomains.header.erb'),
+ order => '00',
+ }
}