Puppet Class: ssh::publish_fingerprints

Defined in:
modules/ssh/manifests/publish_fingerprints.pp

Summary

Provisions a directory for publishing SSH fingerprints collected from PuppetDB

Overview

Parameters:

  • document_root (Stdlib::Unixpath)

    the document root to right fingerprints



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
# File 'modules/ssh/manifests/publish_fingerprints.pp', line 3

class ssh::publish_fingerprints (
    Stdlib::Unixpath $document_root,
) {
    $exported_types = ['ecdsa', 'ed25519']
    $ssh_fingerprints = puppetdb::query_facts(['ssh', 'networking'])

    file{"${document_root}/ssh-fingerprints.txt":
        ensure  => file,
        backup  => false,  # Theses files change often don't back them up
        mode    => '0644',
        owner   => 'root',
        group   => 'root',
        content => epp('ssh/publish_fingerprints/ssh-fingerprints.txt',
                      {'ssh_fingerprints' => $ssh_fingerprints}),
    }

    $params = {
        'ssh_fingerprints' => $ssh_fingerprints,
        'types'            => $exported_types,
    }
    file{ "${document_root}/known_hosts":
        ensure  => file,
        backup  => false,  # Theses files change often don't back them up
        mode    => '0644',
        owner   => 'root',
        group   => 'root',
        content => epp('ssh/publish_fingerprints/known_hosts', $params),
    }

    $exported_types.each |String $type| {
        $params = {
            'ssh_fingerprints' => $ssh_fingerprints,
            'types'            => [$type],
        }
        file{"${document_root}/known_hosts.${type}":
            ensure  => file,
            backup  => false,  # Theses files change often don't back them up
            mode    => '0644',
            owner   => 'root',
            group   => 'root',
            content => epp('ssh/publish_fingerprints/known_hosts', $params),
        }
    }
    file{"${document_root}/known_hosts.rsa":
        ensure => absent,
    }

}