Defined Type: cfssl::signer
- Defined in:
- modules/cfssl/manifests/signer.pp
Summary
configure cfssl api serviceOverview
SPDX-License-Identifier: Apache-2.0
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'modules/cfssl/manifests/signer.pp', line 28
define cfssl::signer (
Stdlib::Host $listen_addr = $facts['networking']['fqdn'],
Stdlib::Port $listen_port = 8888,
Cfssl::Loglevel $log_level = 'info',
String $default_auth_key = 'default_auth',
Cfssl::Expiry $default_expiry = '672h', # 28days
Array[Cfssl::Usage] $default_usages = ['signing', 'key encipherment', 'client auth'],
Stdlib::HTTPUrl $default_crl_url = "http://${listen_addr}/crl",
Stdlib::HTTPUrl $default_ocsp_url = "http://${listen_addr}/ocsp",
Wmflib::Ensure $serve_ensure = 'absent',
Boolean $manage_db = true,
Boolean $manage_services = true,
Cfssl::DB_driver $db_driver = 'sqlite3',
String $db_user = 'cfssl',
Sensitive[String[1]] $db_pass = Sensitive('changeme'),
String $db_name = 'cfssl',
Stdlib::Host $db_host = 'localhost',
Hash[String, Cfssl::Profile] $profiles = {},
Hash[String, Cfssl::Auth_key] $auth_keys = {},
Optional[String] $serve_service = undef,
Optional[Stdlib::Unixpath] $db_conf_file = undef,
Optional[Stdlib::Unixpath] $ca_key_file = undef,
Optional[Stdlib::Unixpath] $ca_file = undef,
Optional[Stdlib::Unixpath] $ca_bundle_file = undef,
Optional[Sensitive[String]] $ca_key_content = undef,
Optional[String] $ca_cert_content = undef,
) {
include cfssl
$safe_title = $title.regsubst('\W', '_', 'G')
$conf_dir = "${cfssl::signer_dir}/${safe_title}"
$conf_file = "${cfssl::signer_dir}/${safe_title}/cfssl.conf"
$ca_dir = "${conf_dir}/ca"
$sqlite_path = "${conf_dir}/cfssl.db"
$_db_conf_file = pick($db_conf_file, "${conf_dir}/db.conf")
$_ca_key_file = pick($ca_key_file, "${ca_dir}/ca_key.pem")
$_ca_file = pick($ca_file, "${ca_dir}/ca.pem")
# We only want to set up a notify if we are managing services
# Or we are explicitly passing a service name to notify
if $manage_services or $serve_service {
$_serve_service = pick($serve_service, "cfssl-serve@${safe_title}")
$notify_service = Service[$_serve_service]
} else {
$_serve_service = undef
$notify_service = undef
}
cfssl::config{$safe_title:
default_auth_key => $default_auth_key,
default_expiry => $default_expiry,
default_usages => $default_usages,
default_crl_url => $default_crl_url,
default_ocsp_url => $default_ocsp_url,
auth_keys => $auth_keys,
profiles => $profiles,
path => $conf_file,
notify => $notify_service,
}
if $manage_db {
cfssl::db {$safe_title:
driver => $db_driver,
username => $db_user,
password => $db_pass,
dbname => $db_name,
host => $db_host,
notify_service => $_serve_service,
sqlite_path => $sqlite_path,
conf_file => $_db_conf_file,
}
}
file{[$conf_dir, $ca_dir]:
ensure => directory,
mode => '0550',
owner => 'root',
group => 'root',
require => Package[$cfssl::packages];
}
if $ca_key_content and $ca_cert_content {
file {
default:
ensure => file,
owner => 'root',
group => 'root',
mode => '0400',
notify => $notify_service;
$_ca_key_file:
show_diff => false,
content => $ca_key_content;
$_ca_file:
content => $ca_cert_content,
mode => '0444';
}
}
if $manage_services {
systemd::service {$_serve_service:
ensure => $serve_ensure,
content => template('cfssl/cfssl.service.erb'),
restart => true,
}
}
}
|