Start with salsa.debian.org role/module
[mirror/dsa-puppet.git] / modules / salsa / manifests / mail.pp
1 #
2 class salsa::mail inherits salsa {
3         package { [
4                 'dovecot-imapd',
5                 'dovecot-lmtpd',
6                 ]:
7                 ensure => installed
8         }
9         service { 'dovecot':
10                 ensure => running,
11         }
12
13         group { '_vmail':
14                 system => true,
15                 ensure => 'present',
16         }
17         user { '_vmail':
18                 system => true,
19                 gid    => '_vmail',
20                 ensure => 'present',
21                 home   => '/srv/mail',
22                 shell  => '/bin/false',
23         }
24
25         file { '/srv/mail':
26                 ensure => 'directory',
27                 mode => '0700',
28                 owner => '_vmail',
29                 group => '_vmail',
30         }
31
32         file { '/etc/dovecot/users':
33                 # XXX fix uid/git/password
34                 mode => '440',
35                 group => 'dovecot',
36                 content  => @(EOF),
37                                 gitlab:$6$PoaX25m/P52bFbEU$tguOOYZZvOD49cmtlrqgRL4nKluakaVudPYOKkEcDZu/fZXXxyqjga9HypFwmBrj3uSP/wt2rqq7BNy22MlU90:::
38                                 | EOF
39         }
40
41
42         file { '/etc/dovecot/conf.d/10-auth.conf':
43                 content  => @(EOF),
44                                 auth_mechanisms = plain
45
46                                 passdb {
47                                   driver = passwd-file
48                                   args = scheme=CRYPT username_format=%u /etc/dovecot/users
49                                 }
50
51                                 userdb {
52                                   driver = passwd-file
53                                   args = username_format=%u /etc/dovecot/users
54                                   default_fields = uid=_vmail gid=_vmail home=/srv/mail/%u
55                                 }
56                                 | EOF
57                 notify => Service['dovecot'],
58         }
59 }