summaryrefslogtreecommitdiff
path: root/sitemodules/profiles/manifests/roundcube.pp
blob: 05bca1a1d6b060cbac6a2ae7f78b850eec6916f1 (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
# Class: profiles::roundcube
# ==========================
#
# This class installs and configures the roundcube webmail system.
#
# Parameters
# ----------
#
# des_key          Key to encrypt the the client cookies, must be exactly 24
#                  characters long
#
# email_host       Hostname of the email server
#
# mail_domain      Mail domain used to find matching user names from client
#                  certificate Email SubjectAlternativeName extensions
#
# master_password  IMAP server master password used for client certificate
#                  authentication
#
# Examples
# --------
#
# @example
#   class roles::myhost {
#     include profiles::roundcube
#   }
#
# Authors
# -------
#
# Jan Dittberner <jandd@cacert.org>
#
# Copyright
# ---------
#
# Copyright 2019 Jan Dittberner
class profiles::roundcube (
  String $des_key,
  String $email_host = 'email.infra.cacert.org',
  String $mail_domain = 'cacert.org',
  String $master_password,
) {
  include profiles::cacert_debrepo

  package { 'mariadb-server':
    ensure => latest,
  }

  package { ['dbconfig-mysql', 'php-zip', 'php-gd', 'libapache2-mod-php', 'roundcube', 'roundcube-plugins', 'roundcube-mysql', 'roundcube-plugin-clientcert-authentication']:
    ensure => latest,
  }

  file { '/etc/roundcube/config.inc.php':
    ensure  => file,
    owner   => 'root',
    group   => 'www-data',
    mode    => '0640',
    content => epp('profiles/roundcube/config.inc.php.epp', {
      des_key     => $des_key,
      email_host  => $email_host,
      plugins     => ['clientcert_authentication', 'managesieve'],
      skin        => 'larry',
      smtp_port   => 587,
      support_url => 'https://bugs.cacert.org/set_project.php?project_id=18;30',
    },
    require => [
      Package['roundcube-core'],
      Package['roundcube-plugins'],
      Package['roundcube-plugin-clientcert-authentication'],
    ],
  }

  file { '/etc/roundcube/plugins/managesieve/config.inc.php':
    ensure  => file,
    owner   => 'root',
    group   => 'www-data',
    mode    => '0640',
    content => epp('profiles/roundcube/managesieve-config.inc.php.epp', {
    },
    require => Package['roundcube-plugins'],
  }

  file { '/etc/roundcube/plugins/clientcert_authentication/config.inc.php':
    ensure  => file,
    owner   => 'root',
    group   => 'www-data',
    mode    => '0640',
    content => epp('profiles/roundcube/clientcert_authentication-config.inc.php.epp', {
      mail_domain     => $mail_domain,
      master_password => $master_password,
    },
    require => Package['roundcube-plugin-clientcert-authentication'],
  }
}