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
|
# File 'functions/save_comply_certs.pp', line 1
function complyadm::save_comply_certs(
Optional[String] $cert_chain = '',
Optional[String] $private_key = '',
Optional[String] $crl = '',
Optional[String] $hiera_data_file_path = 'data/common.yaml',
Optional[String] $pkcs7_public_key_path = 'keys/public_key.pkcs7.pem',
) >> Boolean {
$cert_chain_updated = if $cert_chain != '' {
complyadm::save_yaml_key_value('cert_chain', regsubst(complyadm::encrypt(Sensitive($cert_chain), $pkcs7_public_key_path), '\n', ' ', 'MG'), $hiera_data_file_path)
} else {
false
}
$private_key_updated = if $private_key != '' {
complyadm::save_yaml_key_value('private_key', regsubst(complyadm::encrypt(Sensitive($private_key), $pkcs7_public_key_path), '\n', ' ', 'MG'), $hiera_data_file_path)
} else {
false
}
$crl_updated = if $crl != '' {
complyadm::save_yaml_key_value('crl', regsubst(complyadm::encrypt(Sensitive($crl), $pkcs7_public_key_path), '\n', ' ', 'MG'), $hiera_data_file_path)
} else {
false
}
# return true if any entry updated
true in [$cert_chain_updated, $private_key_updated, $crl_updated]
}
|