Puppet Class: profile::cache::kafka::certificate

Defined in:
modules/profile/manifests/cache/kafka/certificate.pp

Overview

Class profile::cache::kafka::certificate

Installs certificates and keys for varnishkafka to produce to Kafka over TLS. This expects that a 'varnishkafka' SSL/TLS key and certificate is created by Cergen and signed by our PuppetCA, and available in the Puppet private secrets module.

Parameters.

ssl_key_password

The password to decrypt the TLS client certificate. Default: undef

certificate_name

Name of certificate (cergen) in the secrets module. This will be used To find the certificate file secret() puppet paths.

certificate_name

Name of certificate (cergen) in the secrets module. This will be used To find the certificate file secret() puppet paths. You might want to change this if you are testing in Cloud VPS. Default: varnishkafka.

use_puppet_internal_ca

If true, the CA cert.pem file will be assumed to be already installed at /etc/ssl/certs/Puppet_Internal_CA.pem, and will be used as the ssl.ca.location for varnishkafka/librdkafka. Default: true. Set this to false if the certificate name you set is not signed by the Puppet CA, and the cergen created ca.crt.pem file will be used.

Parameters:

  • ssl_key_password (Any) (defaults to: hiera('profile::cache::kafka::certificate::ssl_key_password', undef))
  • certificate_name (Any) (defaults to: hiera('profile::cache::kafka::certificate::certificate_name', 'varnishkafka'))
  • use_puppet_internal_ca (Any) (defaults to: hiera('profile::cache::kafka::certificate::use_puppet_internal_ca', true))
  • ssl_cipher_suites (Any) (defaults to: hiera('profile::cache::kafka::certificate::ssl_cipher_suites', 'ECDHE-ECDSA-AES256-GCM-SHA384'))
  • ssl_curves_list (Any) (defaults to: hiera('profile::cache::kafka::certificate::ssl_curves_list', 'P-256'))
  • ssl_sigalgs_list (Any) (defaults to: hiera('profile::cache::kafka::certificate::ssl_sigalgs_list', 'ECDSA+SHA256'))


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
# File 'modules/profile/manifests/cache/kafka/certificate.pp', line 27

class profile::cache::kafka::certificate(
    $ssl_key_password  = hiera('profile::cache::kafka::certificate::ssl_key_password', undef),
    $certificate_name = hiera('profile::cache::kafka::certificate::certificate_name', 'varnishkafka'),
    $use_puppet_internal_ca = hiera('profile::cache::kafka::certificate::use_puppet_internal_ca', true),
    $ssl_cipher_suites = hiera('profile::cache::kafka::certificate::ssl_cipher_suites', 'ECDHE-ECDSA-AES256-GCM-SHA384'),
    $ssl_curves_list = hiera('profile::cache::kafka::certificate::ssl_curves_list', 'P-256'),
    $ssl_sigalgs_list = hiera('profile::cache::kafka::certificate::ssl_sigalgs_list', 'ECDSA+SHA256'),
) {
    # TLS/SSL configuration
    $ssl_location = '/etc/varnishkafka/ssl'
    $ssl_location_private = '/etc/varnishkafka/ssl/private'

    $ssl_key_location_secrets_path = "certificates/${certificate_name}/${certificate_name}.key.private.pem"
    $ssl_key_location = "${ssl_location_private}/${certificate_name}.key.pem"

    $ssl_certificate_secrets_path = "certificates/${certificate_name}/${certificate_name}.crt.pem"
    $ssl_certificate_location = "${ssl_location}/${certificate_name}.crt.pem"

    file { $ssl_location:
        ensure => 'directory',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }

    file { $ssl_location_private:
        ensure  => 'directory',
        owner   => 'root',
        group   => 'root',
        mode    => '0500',
        require => File[$ssl_location],
    }

    file { $ssl_key_location:
        content => secret($ssl_key_location_secrets_path),
        owner   => 'root',
        group   => 'root',
        mode    => '0400',
        require => File[$ssl_location_private],
    }

    file { $ssl_certificate_location:
        content => secret($ssl_certificate_secrets_path),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
    }

    if $use_puppet_internal_ca {
        $ssl_ca_location = '/etc/ssl/certs/Puppet_Internal_CA.pem'
    }
    else {
        $ssl_ca_location_secrets_path = "certificates/${certificate_name}/ca.crt.pem"
        $ssl_ca_location = "${ssl_location}/ca.crt.pem"

        file { $ssl_ca_location:
            content => secret($ssl_ca_location_secrets_path),
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
        }
    }
}