Puppet Class: profile::mail::vrts

Defined in:
modules/profile/manifests/mail/vrts.pp

Summary

Configures the VRTS alias script generator, which generates aliases to ensure VRTS recipients are forwarded to VRTS

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • gmail_host (Stdlib::Host) (defaults to: lookup('profile::mail::vrts::gmail_host'))

    Gmail server to query for conflicting VRTS accounts

  • aliases_file (Stdlib::Absolutepath) (defaults to: lookup('profile::mail::vrts::aliases_file'))

    Destination path for generated aliases

  • aliases_format (Enum['exim', 'postfix']) (defaults to: lookup('profile::mail::vrts::aliases_format'))

    MTA Server format of generated aliases

  • aliases_folder (Stdlib::Absolutepath) (defaults to: lookup('profile::mail::vrts::aliases_folder'))

    MTA Server folder of existing aliases

  • mysql_dbname (Stdlib::Host) (defaults to: lookup('profile::mail::vrts::mysql_dbname'))

    MySQL database name

  • mysql_password (Sensitive[String[1]]) (defaults to: lookup('profile::mail::vrts::mysql_password'))

    MySQL database password

  • mysql_host (Stdlib::Host) (defaults to: lookup('profile::mail::vrts::mysql_host'))

    MySQL server Hostname

  • mysql_user (String[1]) (defaults to: lookup('profile::mail::vrts::mysql_user'))

    MySQL database user

  • wikimedia_domains (Array[Stdlib::Host]) (defaults to: lookup('profile::mail::vrts::wikimedia_domains'))

    Wikimedia domains for which to generate VRTS aliases

  • next_hop (String[1]) (defaults to: lookup('profile::mail::vrts::next_hop'))


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
# File 'modules/profile/manifests/mail/vrts.pp', line 23

class profile::mail::vrts (
    Stdlib::Host            $gmail_host        = lookup('profile::mail::vrts::gmail_host'),
    Stdlib::Absolutepath    $aliases_file      = lookup('profile::mail::vrts::aliases_file'),
    Enum['exim', 'postfix'] $aliases_format    = lookup('profile::mail::vrts::aliases_format'),
    Stdlib::Absolutepath    $aliases_folder    = lookup('profile::mail::vrts::aliases_folder'),
    Stdlib::Host            $mysql_dbname      = lookup('profile::mail::vrts::mysql_dbname'),
    Sensitive[String[1]]    $mysql_password    = lookup('profile::mail::vrts::mysql_password'),
    Stdlib::Host            $mysql_host        = lookup('profile::mail::vrts::mysql_host'),
    String[1]               $mysql_user        = lookup('profile::mail::vrts::mysql_user'),
    Array[Stdlib::Host]     $wikimedia_domains = lookup('profile::mail::vrts::wikimedia_domains'),
    String[1]               $next_hop          = lookup('profile::mail::vrts::next_hop'),
){
    file { '/etc/vrts':
        ensure => directory,
        mode   => '0555',
    }

    $wikimedia_domains_path = '/etc/vrts/wikimedia_domains'
    file { $wikimedia_domains_path:
        ensure  => present,
        mode    => '0444',
        content => $wikimedia_domains.reduce('') |$memo, $v| {
            "${memo}${v}\n"
        },
    }

    $vrts_aliases_conf = '/etc/vrts/vrts.conf'
    file { $vrts_aliases_conf:
        ensure  => present,
        mode    => '0440',
        owner   => 'postfix',
        group   => 'postfix',
        content => epp('profile/mail/mx/vrts.conf.epp', {
            gmail_smtp_server      => $gmail_host,
            vrts_aliases_file      => $aliases_file,
            vrts_aliases_format    => $aliases_format,
            vrts_aliases_folder    => $aliases_folder,
            vrts_mysql_dbname      => $mysql_dbname,
            vrts_mysql_password    => $mysql_password,
            vrts_mysql_server      => $mysql_host,
            vrts_mysql_user        => $mysql_user,
            wikimedia_domains_path => $wikimedia_domains_path,
            next_hop               => $next_hop,
        })
    }

    ensure_packages(['python3-pymysql'])
    file {'/usr/local/bin/vrts_aliases':
        ensure => file,
        mode   => '0555',
        source => 'puppet:///modules/profile/mail/vrts_aliases.py',
    }

    systemd::timer::job {'generate_vrts_aliases':
        ensure            => 'present',
        description       => "Generate VRTS aliases file for ${aliases_format}",
        command           => "/usr/local/bin/vrts_aliases --config ${vrts_aliases_conf}",
        user              => 'postfix',
        interval          => {'start' => 'OnUnitInactiveSec', 'interval' => '1h'},
        timeout_start_sec => 1800,
    }
}