Skip to content

Commit 7ba7baa

Browse files
committed
added edge_ca validation for identity config (x509 DPS and TPM DPS)
Signed-off-by: Joerg Zeidler <[email protected]>
1 parent 8bd3dd8 commit 7ba7baa

File tree

3 files changed

+42
-13
lines changed

3 files changed

+42
-13
lines changed

src/validators/identity.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ struct Tpm {
121121
#[serde(deny_unknown_fields)]
122122
#[allow(dead_code)]
123123
struct EdgeCA {
124-
cert: String,
125-
pk: String,
124+
method: String,
125+
common_name: String,
126+
url: String,
127+
bootstrap_identity_cert: String,
128+
bootstrap_identity_pk: String,
129+
auto_renew: Option<CertAutoRenew>,
126130
}
127131

128132
#[derive(Debug, Deserialize)]
@@ -144,8 +148,8 @@ struct Urls {
144148
#[serde(deny_unknown_fields)]
145149
#[allow(dead_code, clippy::upper_case_acronyms)]
146150
struct EST {
147-
auth: Auth,
148-
urls: Urls,
151+
auth: Option<Auth>,
152+
urls: Option<Urls>,
149153
trusted_certs: Vec<String>,
150154
}
151155

@@ -307,14 +311,9 @@ pub fn validate_identity(
307311
.as_ref()
308312
.and_then(|ci| ci.est.as_ref())
309313
.map(|est| {
310-
est.auth.bootstrap_identity_cert.as_str()
311-
== "file:///mnt/cert/priv/device_id_cert.pem"
312-
&& est.auth.bootstrap_identity_cert.as_str()
313-
== "file:///mnt/cert/priv/device_id_cert.pem"
314-
&& est
315-
.trusted_certs
316-
.iter()
317-
.any(|e| e == "file:///mnt/cert/ca/ca.crt")
314+
est.trusted_certs.iter().any(|e| {
315+
e == "file:///mnt/cert/ca/ca.crt" || e == "file:///mnt/cert/ca/edge_ca.crt"
316+
})
318317
})
319318
{
320319
out.push(WARN_UNEXPECTED_PATH)

testfiles/identity_config_dps_tpm.toml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,21 @@ global_endpoint = "https://global.azure-devices-provisioning.net"
66
id_scope = "my-scope-id"
77

88
[provisioning.attestation]
9-
method = "tpm"
9+
method = "tpm"
10+
11+
[cert_issuance.est]
12+
trusted_certs = [
13+
"file:///mnt/cert/ca/edge_ca.crt",
14+
]
15+
16+
[edge_ca]
17+
method = "est"
18+
common_name = "test"
19+
url = "my-est-url"
20+
bootstrap_identity_cert = "file:///mnt/cert/priv/edge_ca_cert.pem"
21+
bootstrap_identity_pk = "file:///mnt/cert/priv/edge_ca_cert_key.pem"
22+
23+
[edge_ca.auto_renew]
24+
rotate_key = true
25+
threshold = "80%"
26+
retry = "4%"

testfiles/identity_config_dps_x509_est.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ retry = "4%"
2121
[cert_issuance.est]
2222
trusted_certs = [
2323
"file:///mnt/cert/ca/ca.crt",
24+
"file:///mnt/cert/ca/edge_ca.crt",
2425
]
2526

2627
[cert_issuance.est.auth]
@@ -29,3 +30,15 @@ bootstrap_identity_pk = "file:///mnt/cert/priv/device_id_cert_key.pem"
2930

3031
[cert_issuance.est.urls]
3132
default = "my-est-url"
33+
34+
[edge_ca]
35+
method = "est"
36+
common_name = "test-omnect-est"
37+
url = "my-est-url"
38+
bootstrap_identity_cert = "file:///mnt/cert/priv/edge_ca_cert.pem"
39+
bootstrap_identity_pk = "file:///mnt/cert/priv/edge_ca_cert_key.pem"
40+
41+
[edge_ca.auto_renew]
42+
rotate_key = true
43+
threshold = "80%"
44+
retry = "4%"

0 commit comments

Comments
 (0)