mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-22 17:34:56 +02:00
Adds support for PKCS#11 v2.20 and/or KMIP 1.2 compatible HSMs. Includes backward compatible extensions to the krill.conf syntax. Includes HSM related developer docs. Excludes HSM specific API (REST, krillc, Prometheus) or UI extensions.
This commit is contained in:
+8
-2
@@ -493,6 +493,7 @@ impl KrillClient {
|
||||
fn init_config(&self, details: KrillInitDetails) -> Result<ApiResponse, Error> {
|
||||
let defaults = include_str!("../../defaults/krill.conf");
|
||||
let multi_add_on = include_str!("../../defaults/krill-multi-user.conf");
|
||||
let hsm_add_on = include_str!("../../defaults/krill-hsm.conf");
|
||||
|
||||
let mut config = defaults.to_string();
|
||||
config = config.replace("### admin_token =", &format!("admin_token = \"{}\"", self.token));
|
||||
@@ -518,8 +519,13 @@ impl KrillClient {
|
||||
config.push_str(multi_add_on);
|
||||
}
|
||||
|
||||
let c: Config = toml::from_slice(config.as_ref()).map_err(Error::init)?;
|
||||
c.verify().map_err(Error::init)?;
|
||||
if details.hsm() {
|
||||
config.push_str("\n\n\n");
|
||||
config.push_str(hsm_add_on);
|
||||
}
|
||||
|
||||
let mut c: Config = toml::from_slice(config.as_ref()).map_err(Error::init)?;
|
||||
c.process().map_err(Error::init)?;
|
||||
|
||||
Ok(ApiResponse::GenericBody(config))
|
||||
}
|
||||
|
||||
@@ -2440,6 +2440,7 @@ pub struct KrillInitDetails {
|
||||
data_dir: Option<String>,
|
||||
log_file: Option<String>,
|
||||
multi_user: bool,
|
||||
hsm: bool,
|
||||
}
|
||||
|
||||
impl KrillInitDetails {
|
||||
@@ -2448,6 +2449,7 @@ impl KrillInitDetails {
|
||||
data_dir: None,
|
||||
log_file: None,
|
||||
multi_user: true,
|
||||
hsm: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2470,6 +2472,10 @@ impl KrillInitDetails {
|
||||
pub fn multi_user(&self) -> bool {
|
||||
self.multi_user
|
||||
}
|
||||
|
||||
pub fn hsm(&self) -> bool {
|
||||
self.hsm
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for KrillInitDetails {
|
||||
@@ -2478,6 +2484,7 @@ impl Default for KrillInitDetails {
|
||||
data_dir: None,
|
||||
log_file: None,
|
||||
multi_user: false,
|
||||
hsm: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user