summaryrefslogtreecommitdiff
path: root/manifests/system.pp
blob: 909f4b581023bf40c58711a17455edc18faae892 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
class mail::system(
  $mydestination       = lookup('mail::mydestination', undef, undef,       '$myhostname, localhost.$mydomain, localhost'),
  $relay_domains       = lookup('mail::relay_domains', undef, undef,       ''),
  $mynetworks          = lookup('mail::postfix_mynetworks', undef, undef,  "127.0.0.0/8"),
  $root_mail_recipient = lookup('mail::root_mail_recipient', undef, undef, 'nobody')
) {

  # Base postfix class
  class { 'postfix':
    root_mail_recipient     => $root_mail_recipient,
    smtp_listen             => "all",
    use_amavisd             => "yes",
    use_dovecot_lda         => "yes",
    use_schleuder           => lookup('mail::schleuder', undef, undef, false) ? {
      true    => "yes",
      default => "no",
    },
    use_sympa               => lookup('mail::sympa', undef, undef, false) ? {
      true    => "yes",
      default => "no",
    },
    use_mlmmj               => lookup('mail::mlmmj', undef, undef, false) ? {
      true    => "yes",
      default => "no",
    },
    use_firma               => lookup('mail::firma', undef, undef, false) ? {
      true    => "yes",
      default => "no",
    },
    use_submission          => "yes",
    use_smtps               => "no",
    anon_sasl               => "yes",
    manage_transport_regexp => "yes",
    manage_virtual_regexp   => "yes",
    manage_header_checks    => "yes",
    manage_tls_policy       => lookup('mail::postfix_manage_tls_policy', undef, undef, 'no')
  }

  # Log rotation
  file { '/etc/logrotate.d/postfix':
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    source  => 'puppet:///modules/mail/postfix/logrotate',
  }

  # SSL support
  include ssl

  # Common subsystems
  include mail::packages
  include mail::tls::hardened
  include mail::amavisd
  include mail::header_checks
  include mail::clamav
  include mail::spamassassin
  include mail::opendkim

  # DKIM
  mail::opendkim::key { "$domain": }

  # Default parameters
  include mail::firma::params
  include mail::mlmmj::params
  include mail::sympa::params
  include mail::schleuder::params
  include mail::virtual::params
  include mail::virtual::web::params

  # Virtual mail system
  case lookup('mail::virtual', undef, undef, false) {
    true: {
      class { 'mail::virtual': }
    }
    default: {
      include mail::regular
    }
  }

  # Sympa mailing list manager
  case lookup('mail::sympa', undef, undef, false) {
    true: {
      class { 'mail::sympa': }
      $sympa_relay_domains = ", ${mail::sympa::subdomain}.${domain}"
    }
    'disabled': {
      $sympa_relay_domains = ''
      include mail::sympa::disabled
    }
    default: {
      $sympa_relay_domains = ''
    }
  }

  # Schleuder mailing list manager
  case lookup('mail::schleuder', undef, undef, false) {
    true: {
      class { 'mail::schleuder': }
      $schleuder_relay_domains = ", ${mail::schleuder::subdomain}.${domain}"
    }
    default: {
      $schleuder_relay_domains = ''
    }
  }

  # Mlmmj
  case lookup('mail::mlmmj', undef, undef, false) {
    true: {
      class { 'mail::mlmmj': }

      $mlmmj_relay_domains = ", ${mail::mlmmj::subdomain}.${domain}"
    }
    default: {
      $mlmmj_relay_domains = ''
    }
  }

  # Firma
  case lookup('mail::firma', undef, undef, false) {
    true: {
      class { 'mail::firma': }
      $firma_relay_domains = ", ${mail::firma::subdomain}.${domain}"
    }
    default: {
      $firma_relay_domains = ''
    }
  }

  # GPG Mail Gateway
  case lookup('mail::gpg_mailgate', undef, undef, false) {
    true: {
      class { 'mail::gpg_mailgate': }
    }
  }

  case $relay_domains {
    '': { $real_relay_domains = "${mydestination}${sympa_relay_domains}${schleuder_relay_domains}${mlmmj_relay_domains}${firma_relay_domains}" }
  }

  # Include base configuration
  include mail::base
}