Skip to content

Commit f0aab22

Browse files
Isaac-Matthewsansasaki
authored andcommitted
config changes
Signed-off-by: Isaac-Matthews <[email protected]>
1 parent e2b24db commit f0aab22

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

keylime-agent.conf

+12-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ tpm_signing_alg = "rsassa"
227227
# To override ek_handle, set KEYLIME_AGENT_EK_HANDLE environment variable.
228228
ek_handle = "generate"
229229

230-
# Enable IDevID and IAK usage and set their algorithms.
230+
# Enable IDevID and IAK usage
231+
enable_iak_idevid = true
232+
233+
# Select IDevID and IAK templates or algorithms for regenerating the keys.
231234
# By default the template will be detected automatically from the certificates. This will happen if iak_idevid_template is left empty or set as "default" or "detect".
232235
# Choosing a template will override the name and asymmetric algorithm choices. To use these choices, set iak_idevid_template to "manual"
233236
# Templates are specified in the TCG document found here, section 7.3.4:
@@ -237,12 +240,19 @@ ek_handle = "generate"
237240
# iak_idevid_template: default, detect, H-1, H-2, H-3, H-4, H-5, manual
238241
# iak_idevid_asymmetric_alg: rsa, ecc
239242
# iak_idevid_name_alg: sha256, sm3_256, sha384, sha512
240-
enable_iak_idevid = false
241243
iak_idevid_template = "detect"
242244
# In order for these values to be used, set the iak_idevid_template option to manual
243245
iak_idevid_asymmetric_alg = "rsa"
244246
iak_idevid_name_alg = "sha256"
245247

248+
# Alternatively if the keys are persisted, provide the handles for their location below, and optionally their passwords.
249+
# If handles are provided, they will take priority over templates/algorithms selected above.
250+
# To use a hex password, use the prefix "hex:" at the start of the password.
251+
idevid_password = ""
252+
idevid_handle = ""
253+
254+
iak_password = ""
255+
iak_handle = ""
246256

247257
# The name of the file containing the X509 IAK certificate.
248258
# If set as "default", the "iak-cert.crt" value is used

keylime-agent/src/config.rs

+54
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ pub static DEFAULT_ENABLE_IAK_IDEVID: bool = false;
6262
pub static DEFAULT_IAK_IDEVID_ASYMMETRIC_ALG: &str = "rsa";
6363
pub static DEFAULT_IAK_IDEVID_NAME_ALG: &str = "sha256";
6464
pub static DEFAULT_IAK_IDEVID_TEMPLATE: &str = "H-1";
65+
pub static DEFAULT_IDEVID_PASSWORD: &str = "";
66+
pub static DEFAULT_IAK_PASSWORD: &str = "";
67+
pub static DEFAULT_IDEVID_HANDLE: &str = "";
68+
pub static DEFAULT_IAK_HANDLE: &str = "";
6569
pub static DEFAULT_RUN_AS: &str = "keylime:tss";
6670
pub static DEFAULT_AGENT_DATA_PATH: &str = "agent_data.json";
6771
pub static DEFAULT_IMA_ML_PATH: &str =
@@ -111,6 +115,10 @@ pub(crate) struct EnvConfig {
111115
pub iak_idevid_asymmetric_alg: Option<String>,
112116
pub iak_idevid_name_alg: Option<String>,
113117
pub iak_idevid_template: Option<String>,
118+
pub idevid_password: Option<String>,
119+
pub iak_password: Option<String>,
120+
pub idevid_handle: Option<String>,
121+
pub iak_handle: Option<String>,
114122
pub run_as: Option<String>,
115123
pub agent_data_path: Option<String>,
116124
pub ima_ml_path: Option<String>,
@@ -157,6 +165,10 @@ pub(crate) struct AgentConfig {
157165
pub iak_idevid_asymmetric_alg: String,
158166
pub iak_idevid_name_alg: String,
159167
pub iak_idevid_template: String,
168+
pub idevid_password: String,
169+
pub iak_password: String,
170+
pub idevid_handle: String,
171+
pub iak_handle: String,
160172
pub run_as: String,
161173
pub agent_data_path: String,
162174
pub ima_ml_path: String,
@@ -328,6 +340,24 @@ impl EnvConfig {
328340
v.to_string().into(),
329341
);
330342
}
343+
if let Some(ref v) = self.idevid_password {
344+
_ = agent.insert(
345+
"idevid_password".to_string(),
346+
v.to_string().into(),
347+
);
348+
}
349+
if let Some(ref v) = self.iak_password {
350+
_ = agent.insert(
351+
"iak_password".to_string(),
352+
v.to_string().into(),
353+
);
354+
}
355+
if let Some(ref v) = self.idevid_handle {
356+
_ = agent.insert("idevid_handle".to_string(), v.to_string().into());
357+
}
358+
if let Some(ref v) = self.iak_handle {
359+
_ = agent.insert("iak_handle".to_string(), v.to_string().into());
360+
}
331361
if let Some(ref v) = self.run_as {
332362
_ = agent.insert("run_as".to_string(), v.to_string().into());
333363
}
@@ -525,6 +555,22 @@ impl Source for KeylimeConfig {
525555
"iak_idevid_template".to_string(),
526556
self.agent.iak_idevid_template.to_string().into(),
527557
);
558+
_ = m.insert(
559+
"idevid_password".to_string(),
560+
self.agent.idevid_password.to_string().into(),
561+
);
562+
_ = m.insert(
563+
"iak_password".to_string(),
564+
self.agent.iak_password.to_string().into(),
565+
);
566+
_ = m.insert(
567+
"idevid_handle".to_string(),
568+
self.agent.idevid_handle.to_string().into(),
569+
);
570+
_ = m.insert(
571+
"iak_handle".to_string(),
572+
self.agent.iak_handle.to_string().into(),
573+
);
528574
_ = m.insert(
529575
"run_as".to_string(),
530576
self.agent.run_as.to_string().into(),
@@ -606,6 +652,10 @@ impl Default for AgentConfig {
606652
.to_string(),
607653
iak_idevid_name_alg: DEFAULT_IAK_IDEVID_NAME_ALG.to_string(),
608654
iak_idevid_template: DEFAULT_IAK_IDEVID_TEMPLATE.to_string(),
655+
idevid_password: DEFAULT_IDEVID_PASSWORD.to_string(),
656+
iak_password: DEFAULT_IAK_PASSWORD.to_string(),
657+
idevid_handle: DEFAULT_IDEVID_HANDLE.to_string(),
658+
iak_handle: DEFAULT_IAK_HANDLE.to_string(),
609659
ima_ml_path: "default".to_string(),
610660
measuredboot_ml_path: "default".to_string(),
611661
}
@@ -1124,6 +1174,10 @@ mod tests {
11241174
),
11251175
("IAK_IDEVID_NAME_ALG", "override_iak_idevid_name_alg"),
11261176
("IAK_IDEVID_TEMPLATE", "override_iak_idevid_template"),
1177+
("IDEVID_PASSWORD", "override_idevid_password"),
1178+
("IAK_PASSWORD", "override_iak_password"),
1179+
("IDEVID_HANDLE", "override_idevid_handle"),
1180+
("IAK_HANDLE", "override_iak_handle"),
11271181
("RUN_AS", "override_run_as"),
11281182
("AGENT_DATA_PATH", "override_agent_data_path"),
11291183
("IMA_ML_PATH", "override_ima_ml_path"),

0 commit comments

Comments
 (0)