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
|
# File 'functions/cert/files.pp', line 7
function icinga::cert::files(
String $name,
Optional[Stdlib::Absolutepath] $default_dir,
Optional[Stdlib::Absolutepath] $key_file = undef,
Optional[Stdlib::Absolutepath] $cert_file = undef,
Optional[Stdlib::Absolutepath] $cacert_file = undef,
Optional[Variant[String, Sensitive]] $key = undef,
Optional[String] $cert = undef,
Optional[String] $cacert = undef,
) >> Hash {
# @param name
# The base name of certicate, key and ca file,
# if the corosponding file parameter is not set.
#
# @param default_dir
# The default directory to use for the stored files,
# if the corosponding file parameter is not set.
#
# @param key_file
# Location of the private key.
#
# @param cert_file
# Location of the certificate.
#
# @param cacert_file
# Location of the CA certificate.
#
# @param key
# The private key to store in specified key_file.
#
# @param cert
# The certificate to store in specified cert_file.
#
# @param cacert
# The CA certificate to store in specified cacert_file.
#
$result = {
'key' => if $key =~ Sensitive {
$key
} elsif $key =~ String {
Sensitive($key)
} else {
undef
},
'key_file' => if $key {
if $key_file {
$key_file
} else {
"${default_dir}/${name}.key"
}
} else {
$key_file
},
'cert' => $cert,
'cert_file' => if $cert {
if $cert_file {
$cert_file
} else {
"${default_dir}/${name}.crt"
}
} else {
$cert_file
},
'cacert' => $cacert,
'cacert_file' => if $cacert {
if $cacert_file {
$cacert_file
} else {
"${default_dir}/${name}_ca.crt"
}
} else {
$cacert_file
},
}
$result
}
|