summaryrefslogtreecommitdiff
path: root/puppet/modules/site_postfix/manifests/mx.pp
blob: 4bab7722ab93c369ccc5c612e7b463f1ba4286f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class site_postfix::mx {

  $domain_hash         = hiera ('domain')
  $domain              = $domain_hash['full_suffix']
  $mx_hash             = hiera('mx')

  $root_mail_recipient = $mx_hash['contact']
  $postfix_smtp_listen = 'all'

  postfix::config {
    'mydestination':
      value => "\$myorigin, localhost, localhost.\$mydomain, ${domain}";
    'smtpd_recipient_restrictions':
      value => 'check_recipient_access hash:/etc/postfix/recipient,reject_unauth_destination';
    'mailbox_size_limit':
      value => '0';
    'home_mailbox':
      value => 'Maildir/';
    'virtual_alias_maps':
      value => 'hash:/etc/postfix/virtual';
  }

  postfix::hash { '/etc/postfix/virtual': }
  postfix::hash { '/etc/postfix/recipient': }

  # for now, accept all mail
  line {'deliver to vmail':
    file    => '/etc/postfix/recipient',
    line    => "@${domain} vmail",
    notify  => Exec['generate /etc/postfix/recipient.db'],
    require => Package['postfix'],
  }

  postfix::virtual { "@${domain}": destination => 'vmail'; }
  #postfix::mailalias { 'vmail': recipient => 'vmail' }

  user { 'vmail':
    ensure     => present,
    comment    => 'Leap Mailspool',
    home       => '/var/mail/vmail',
    shell      => '/bin/false',
    managehome => true,
  }

  user { 'vmail':
    ensure     => present,
    comment    => 'Leap Mailspool',
    home       => '/var/mail/vmail',
    shell      => '/bin/false',
    managehome => true,
  }

  include ::postfix
}