Defined Type: cfssl::csr
- Defined in:
- modules/cfssl/manifests/csr.pp
Summary
generate a CSR file at $title with the input dataOverview
SPDX-License-Identifier: Apache-2.0
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 |
# File 'modules/cfssl/manifests/csr.pp', line 3
define cfssl::csr (
String $common_name,
Array[Cfssl::Common_name] $hosts = [],
Array[Cfssl::Name] $names = [],
Cfssl::Key $key = {'algo' => 'ecdsa', 'size' => 256},
Wmflib::Ensure $ensure = 'present',
) {
$_names = $names.map |Cfssl::Name $name| {
{
'C' => $name['country'],
'L' => $name['locality'],
'O' => $name['organisation'],
'OU' => $name['organisational_unit'],
'S' => $name['state'],
}
}
$_hosts = $common_name in $hosts ? {
true => $hosts,
default => $hosts + [$common_name],
}
$csr = {
'CN' => $common_name,
'hosts' => $_hosts,
'key' => $key,
'names' => $_names,
}
file{ $title:
ensure => stdlib::ensure($ensure, 'file'),
owner => 'root',
group => 'root',
mode => '0400',
content => $csr.to_json_pretty()
}
}
|