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
|
define ssl::cert(
$ensure = present,
$owner = 'root',
$group = 'root',
$pubmode = '644',
$privmode = '600',
$base = '/etc/ssl',
$private = true,
$main = false,
$verify = true,
) {
file { "${base}/certs/${name}.crt":
ensure => $ensure,
owner => $owner,
group => $group,
mode => $pubmode,
source => $ensure ? {
'present' => "puppet:///ssl/${name}.crt",
default => undef,
},
require => File["${base}/certs"],
}
if ($private == true) {
file { "${base}/private/$name.pem":
ensure => $ensure,
owner => $owner,
group => $group,
mode => $privmode,
backup => false, # Do not backup the private key
source => $ensure ? {
'present' => "puppet:///ssl/${name}.pem",
default => undef,
},
require => File["${base}/private"],
}
}
if ($main == true) {
file { "${base}/certs/cert.crt":
ensure => "${base}/certs/${name}.crt",
}
file { "${base}/private/cert.pem":
ensure => "${base}/private/${name}.pem",
}
}
ssl::check { "${name}":
file => true,
base => $base,
ensure => $ensure ? {
present => $verify ? {
true => present,
default => absent,
},
default => absent,
},
}
}
|