Puppet Class: profile::lists

Defined in:
modules/profile/manifests/lists.pp

Overview

Parameters:

  • lists_servername (Stdlib::Fqdn) (defaults to: lookup('mailman::lists_servername'))
  • prometheus_nodes (Array[String]) (defaults to: lookup('prometheus_nodes'))
  • primary_host (Optional[String]) (defaults to: lookup('profile::lists::primary_host', {'default_value' => undef}))
  • standby_host (Optional[String]) (defaults to: lookup('profile::lists::standby_host', {'default_value' => undef}))
  • lists_ipv4 (Optional[Stdlib::IP::Address]) (defaults to: lookup('profile::lists::ipv4', {'default_value' => undef}))
  • lists_ipv6 (Optional[Stdlib::IP::Address]) (defaults to: lookup('profile::lists::ipv6', {'default_value' => undef}))
  • acme_chief_cert (Optional[String]) (defaults to: lookup('profile::lists::acme_chief_cert', {'default_value' => undef}))
  • db_host (Optional[Stdlib::Fqdn]) (defaults to: lookup('profile::lists::db_host', {'default_value' => undef}))
  • db_name (Optional[String]) (defaults to: lookup('profile::lists::db_name', {'default_value' => undef}))
  • db_user (Optional[String]) (defaults to: lookup('profile::lists::db_user', {'default_value' => undef}))
  • db_password (Optional[String]) (defaults to: lookup('profile::lists::db_password', {'default_value' => undef}))
  • webdb_name (Optional[String]) (defaults to: lookup('profile::lists::web::db_name', {'default_value' => undef}))
  • webdb_user (Optional[String]) (defaults to: lookup('profile::lists::web::db_user', {'default_value' => undef}))
  • webdb_password (Optional[String]) (defaults to: lookup('profile::lists::web::db_password', {'default_value' => undef}))
  • api_password (Optional[String]) (defaults to: lookup('profile::lists::api_password', {'default_value' => undef}))
  • web_secret (Optional[String]) (defaults to: lookup('profile::lists::web::secret', {'default_value' => undef}))
  • archiver_key (Optional[String]) (defaults to: lookup('profile::lists::archiver_key', {'default_value' => undef}))
  • memcached (Optional[String]) (defaults to: lookup('profile::lists::memcached', {'default_value' => undef}))
  • renamed_lists (Hash[String, String]) (defaults to: lookup('profile::lists::renamed_lists'))
  • web_deny_conditions (Array[String]) (defaults to: lookup('profile::lists::web_deny_conditions', {'default_value' => []}))


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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'modules/profile/manifests/lists.pp', line 1

class profile::lists (
    Stdlib::Fqdn $lists_servername            = lookup('mailman::lists_servername'),
    Array[String] $prometheus_nodes           = lookup('prometheus_nodes'),
    Optional[String] $primary_host            = lookup('profile::lists::primary_host', {'default_value' => undef}),
    Optional[String] $standby_host            = lookup('profile::lists::standby_host', {'default_value' => undef}),
    Optional[Stdlib::IP::Address] $lists_ipv4 = lookup('profile::lists::ipv4', {'default_value' => undef}),
    Optional[Stdlib::IP::Address] $lists_ipv6 = lookup('profile::lists::ipv6', {'default_value' => undef}),
    Optional[String] $acme_chief_cert         = lookup('profile::lists::acme_chief_cert', {'default_value' => undef}),
    Optional[Stdlib::Fqdn] $db_host           = lookup('profile::lists::db_host', {'default_value' => undef}),
    Optional[String] $db_name                 = lookup('profile::lists::db_name', {'default_value' => undef}),
    Optional[String] $db_user                 = lookup('profile::lists::db_user', {'default_value' => undef}),
    Optional[String] $db_password             = lookup('profile::lists::db_password', {'default_value' => undef}),
    Optional[String] $webdb_name              = lookup('profile::lists::web::db_name', {'default_value' => undef}),
    Optional[String] $webdb_user              = lookup('profile::lists::web::db_user', {'default_value' => undef}),
    Optional[String] $webdb_password          = lookup('profile::lists::web::db_password', {'default_value' => undef}),
    Optional[String] $api_password            = lookup('profile::lists::api_password', {'default_value' => undef}),
    Optional[String] $web_secret              = lookup('profile::lists::web::secret', {'default_value' => undef}),
    Optional[String] $archiver_key            = lookup('profile::lists::archiver_key', {'default_value' => undef}),
    Optional[String] $memcached               = lookup('profile::lists::memcached', {'default_value' => undef}),
    Hash[String, String] $renamed_lists       = lookup('profile::lists::renamed_lists'),
    # Conditions to deny access to the lists web interface. Found in the private repository if needed.
    Array[String] $web_deny_conditions        = lookup('profile::lists::web_deny_conditions', {'default_value' => []})
){
    include network::constants
    include privateexim::listserve

    # Disable mailman service on the sandby host
    $mailman_service_ensure = $facts['fqdn'] ? {
        $standby_host => 'stopped',
        default       => 'running',
    }

    class { '::mailman3':
        host           => $lists_servername,
        db_host        => $db_host,
        db_name        => $db_name,
        db_user        => $db_user,
        db_password    => $db_password,
        webdb_name     => $webdb_name,
        webdb_user     => $webdb_user,
        webdb_password => $webdb_password,
        api_password   => $api_password,
        archiver_key   => $archiver_key,
        web_secret     => $web_secret,
        memcached      => $memcached,
    }

    $ssl_settings = ssl_ciphersuite('apache', 'mid', true)
    class { 'httpd':
        modules => [
            'ssl',
            'cgid',
            'headers',
            'rewrite',
            'alias',
            'setenvif',
            'auth_digest',
            'proxy_http',
            'proxy_uwsgi'
            ],
    }
    httpd::site { $lists_servername:
        content => template('profile/lists/apache.conf.erb'),
    }

    # Add files in /var/www (docroot)
    file { '/var/www':
        source  => 'puppet:///modules/profile/lists/docroot/',
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        recurse => 'remote',
    }

    # Not using require_package so apt::pin may be applied
    # before attempting to install package.
    package { 'libapache2-mod-security2':
        ensure => present,
    }

    # Ensure that the CRS modsecurity ruleset is not used. it has not
    # yet been tested for compatibility with our mailman instance and may
    # cause breakage.
    file { '/etc/apache2/mods-available/security2.conf':
        ensure  => present,
        source  => 'puppet:///modules/profile/lists/modsecurity/security2.conf',
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        require => Package['libapache2-mod-security2'],
    }

    mailalias { 'root': recipient => 'root@wikimedia.org' }

    # This will be a noop if $lists_ipv[46] are undef
    interface::alias { $lists_servername:
        ipv4 => $lists_ipv4,
        ipv6 => $lists_ipv6,
    }

    if $acme_chief_cert {
        class { 'sslcert::dhparam': }
        acme_chief::cert{ $acme_chief_cert:
            puppet_svc => 'apache2',
            key_group  => 'Debian-exim',
        }
    }

    if $::realm == 'labs' {
        $trusted_networks = ['172.16.0.0/12']
    }
    if $::realm == 'production' {
        $trusted_networks = $network::constants::aggregate_networks.filter |$x| {
            $x !~ /127.0.0.0|::1/
        }
    }

    class { 'spamassassin':
        required_score   => '4.0',
        use_bayes        => '0',
        bayes_auto_learn => '0',
        trusted_networks => $trusted_networks,
    }

    $list_outbound_ips = [
        pick($lists_ipv4, $facts['ipaddress']),
        pick($lists_ipv6, $facts['ipaddress6']),
    ]

    class { 'exim4':
        variant => 'heavy',
        config  => template('profile/exim/exim4.conf.mailman.erb'),
        filter  => template('profile/exim/system_filter.conf.mailman.erb'),
        require => [
            Class['spamassassin'],
            Interface::Alias[$lists_servername],
        ],
    }

    file { "/etc/exim4/aliases/${lists_servername}":
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('profile/exim/listserver_aliases.erb'),
        require => Class['exim4'],
    }

    exim4::dkim { $lists_servername:
        domain   => $lists_servername,
        selector => 'wikimedia',
        content  => secret("dkim/${lists_servername}-wikimedia.key"),
    }

    backup::set { 'var-lib-mailman3': }

    if $primary_host and $standby_host {
        rsync::quickdatacopy { 'var-lib-mailman':
            source_host         => $primary_host,
            dest_host           => $standby_host,
            auto_sync           => false,
            module_path         => '/var/lib/mailman',
            server_uses_stunnel => true,
        }
    }

    class { 'profile::lists::monitoring':
        lists_servername => $lists_servername,
        standby_host     => $standby_host
    }
    class { 'profile::lists::ferm': prometheus_nodes => $prometheus_nodes }
}