summaryrefslogtreecommitdiff
path: root/manifests/postfixadmin.pp
blob: d41053985026592ace4d1ba0481d4f7b44cc66c3 (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
class mail::postfixadmin {
  #
  # Database configuration
  #
  case $postfixadmin_password {
    '': { fail("You need to define \$postfixadmin_password host config") }
  }

  case $postfixadmin_user {
    '': { $postfixadmin_user = "postfix" }
  }

  case $postfixadmin_hosts {
    '': { $postfixadmin_hosts = "localhost" }
  }

  case $postfixadmin_dbname {
    '': { $postfixadmin_dbname= "postfix" }
  }

  database::instance { "$postfixadmin_dbname":
    password => "$postfixadmin_password",
  }

  #
  # Postfix configuration
  #
  postfix::config { "virtual_mailbox_domains":
    value   => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf',
    require => File['/etc/postfix/sql/mysql_virtual_domains_maps.cf'],
  }

  postfix::config { "virtual_alias_maps":
    value   => 'hash:/etc/postfix/virtual, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf',
    require => File['/etc/postfix/sql/mysql_virtual_alias_maps.cf',
                    '/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf',
                    '/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf' ],
  }

  postfix::config { "virtual_mailbox_maps": 
    value   => 'proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf',
    require => File['/etc/postfix/sql/mysql_virtual_mailbox_maps.cf',
                    '/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf' ],
  }

  #
  # Map files
  #
  file { "/etc/postfix/sql/mysql_virtual_domains_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_domains_maps.cf.erb'),
  }

  file { "/etc/postfix/sql/mysql_virtual_alias_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_alias_maps.cf.erb'),
  }

  file { "/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_alias_domain_maps.cf'),
  }

  file { "/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf'),
  }

  file { "/etc/postfix/sql/mysql_virtual_mailbox_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_mailbox_maps.cf'),
  }

  file { "/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf":
    ensure  => present,
    owner   => root,
    mode    => 0600,
    content => template('postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf'),
  }

  #
  # Additional for quota support
  #
  #postfix::config { "virtual_mailbox_limit_maps": 
  #  value   => 'mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf',
  #  require => File['/etc/postfix/mysql_virtual_mailbox_limit_maps.cf'],
  #}
  #
  #postfix::config { "virtual_create_maildirsize":     value => 'yes' }
  #postfix::config { "virtual_mailbox_extended ":      value => 'yes' }
  #postfix::config { "virtual_mailbox_limit_override": value => 'yes' }
  #postfix::config { "virtual_maildir_limit_message":  value => 'The user's maildir has overdrawn his quota, try again later.' }
  #postfix::config { "virtual_overquota_bounce":       value => 'yes' }
  #
  #file { "/etc/postfix/mysql_virtual_mailbox_limit_maps.cf":
  #  ensure  => present,
  #  owner   => root,
  #  mode    => 0600,
  #  content => template('postfix/sql/mysql_virtual_mailbox_limit_maps.cf'),
  #}
}