Skip to content

Commit 87e96b8

Browse files
committed
ci(https support ): add test for https support DI
- still WIP Signed-off-by: Sarita Mahajan <[email protected]>
1 parent a281209 commit 87e96b8

File tree

7 files changed

+139
-1
lines changed

7 files changed

+139
-1
lines changed

integration-tests/templates/manufacturing-server.yml.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ownership_voucher_store_driver:
88
public_key_store_driver:
99
Directory:
1010
path: {{ config_dir }}/keys/
11-
bind: {{ bind }}
11+
bind_http: {{ bind }}
12+
bind_https: {{ bind_https }}
1213
rendezvous_info:
1314
- dns: localhost
1415
device_port: 8082
@@ -33,3 +34,5 @@ manufacturing:
3334
owner_cert_path: {{ keys_path }}/owner_cert.pem
3435
device_cert_ca_private_key: {{ keys_path }}/device_ca_key.der
3536
device_cert_ca_chain: {{ keys_path }}/device_ca_cert.pem
37+
manufacturing_server_https_cert: {{ manufacturing_server_https_cert_path }}/manufacturing_server_https_cert.crt
38+
manufacturing_server_https_key: {{ manufacturing_server_https_key_path }}/manufacturing_server_https_key.key

integration-tests/tests/di_diun.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ async fn test_device_credentials_already_active() -> Result<()> {
2525
cfg.insert("rendezvous_port", "1337");
2626
cfg.insert("diun_key_type", "FileSystem");
2727
cfg.insert("device_identification_format", "SerialNumber");
28+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
29+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
30+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8096"));
2831
Ok(())
2932
})?)
3033
},
@@ -109,6 +112,9 @@ async fn test_device_credentials_generated_with_mac_address() -> Result<()> {
109112
cfg.insert("rendezvous_port", "1337");
110113
cfg.insert("diun_key_type", "FileSystem");
111114
cfg.insert("device_identification_format", "MACAddress");
115+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
116+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
117+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
112118
Ok(())
113119
})?)
114120
},
@@ -207,6 +213,9 @@ async fn test_device_credentials_with_tpm() -> Result<()> {
207213
cfg.insert("rendezvous_port", "1337");
208214
cfg.insert("diun_key_type", "Tpm");
209215
cfg.insert("device_identification_format", "SerialNumber");
216+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
217+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
218+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
210219
Ok(())
211220
})?)
212221
},
@@ -254,6 +263,10 @@ async fn test_device_credentials_generated_with_mac_address_no_user_given_iface(
254263
cfg.insert("rendezvous_port", "1337");
255264
cfg.insert("diun_key_type", "FileSystem");
256265
cfg.insert("device_identification_format", "MACAddress");
266+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
267+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
268+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
269+
257270
Ok(())
258271
})?)
259272
},
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
mod common;
3+
use common::{Binary, LogSide, TestContext};
4+
use std::env;
5+
use std::path::Path;
6+
use std::time::Duration;
7+
use anyhow::{Context, Result};
8+
const L: LogSide = LogSide::Test;
9+
10+
#[tokio::test]
11+
async fn di_diun_https_test() -> Result<()> {
12+
let mut ctx = TestContext::new().context("Error building test context")?;
13+
14+
let mfg_server = ctx
15+
.start_test_server(
16+
Binary::ManufacturingServer,
17+
|cfg| {
18+
Ok(cfg.prepare_config_file(None, |cfg| {
19+
cfg.insert("rendezvous_port", "1337");
20+
cfg.insert("diun_key_type", "FileSystem");
21+
cfg.insert("device_identification_format", "SerialNumber");
22+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
23+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
24+
// cfg.insert("bind_http", "8085");
25+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
26+
Ok(())
27+
})?)
28+
},
29+
|_| Ok(()),
30+
)
31+
.context("Error creating manufacturing server")?;
32+
ctx.wait_until_servers_ready()
33+
.await
34+
.context("Error waiting for servers to start")?;
35+
36+
37+
38+
let client_result = ctx
39+
.run_client(
40+
Binary::ManufacturingClient,
41+
Some(&mfg_server),
42+
|cfg| {
43+
cfg.env("DEVICE_CREDENTIAL_FILENAME", "devicecredential.dc")
44+
.env("MANUFACTURING_SERVER_URL", "https://localhost:8086")
45+
.env("DEV_ENVIRONMENT", "1")
46+
.env("DIUN_PUB_KEY_INSECURE", "true");
47+
Ok(())
48+
},
49+
Duration::from_secs(5),
50+
)
51+
.context("Error running manufacturing client")?;
52+
client_result
53+
.expect_success()
54+
.context("Manufacturing client failed")?;
55+
56+
let dc_path = client_result.client_path().join("devicecredential.dc");
57+
L.l(format!("Device Credential should be in {:?}", dc_path));
58+
assert!(Path::new(&dc_path).exists());
59+
60+
Ok(())
61+
}

integration-tests/tests/e2e.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ where
192192
cfg.insert("diun_key_type", diun_key_type);
193193
cfg.insert("rendezvous_port", &rendezvous_server.server_port().unwrap());
194194
cfg.insert("device_identification_format", "SerialNumber");
195+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
196+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
197+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
198+
195199
Ok(())
196200
})?)
197201
},
@@ -514,6 +518,10 @@ where
514518
cfg.insert("diun_key_type", diun_key_type);
515519
cfg.insert("rendezvous_port", &rendezvous_server.server_port().unwrap());
516520
cfg.insert("device_identification_format", "SerialNumber");
521+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
522+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
523+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
524+
517525
Ok(())
518526
})?)
519527
},

integration-tests/tests/service_info.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ where
106106
cfg.insert("diun_key_type", diun_key_type);
107107
cfg.insert("rendezvous_port", &rendezvous_server.server_port().unwrap());
108108
cfg.insert("device_identification_format", "SerialNumber");
109+
cfg.insert("manufacturing_server_https_cert_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
110+
cfg.insert("manufacturing_server_https_key_path", "/workspaces/fido-device-onboard-rs/integration-tests/tests/test-data/https-test");
111+
cfg.insert("bind_https", &format!("0.0.0.0:{}","8086"));
109112
Ok(())
110113
})?)
111114
},
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDqzCCApMCFDBq5YwvijIjOB6U4yFgJpJwHTsEMA0GCSqGSIb3DQEBCwUAMIGR
3+
MQswCQYDVQQGEwJJRTEPMA0GA1UECAwGR2Fsd2F5MQ8wDQYDVQQHDAZHYWx3YXkx
4+
EDAOBgNVBAoMB1JlZCBIYXQxDDAKBgNVBAsMA1I0RTEcMBoGA1UEAwwTd3d3LmZk
5+
by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kHV
21+
pmRu5tNQOqLctpmIr+M1/JQDuhkoh+MyJBfEwzG6Tw==
22+
-----END CERTIFICATE-----
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDIihQOM4+A2d0v
3+
OR6LBzQ+4QGqTezEkuofuMXSQusWQXuBJEjab7o9tiNPW8XZnTweCgyNJiiIczOU
4+
E5niI+Xoxmnr4rg2y7hdbdgi22+A6a4/bkvNV2rbaknUQ3lmuBGURn94hqK8m9io
5+
HUWqk9bMuUYdinzWvtuu8CRJWehLAY416IwTtsoPnVu+VNaCIS7UDxVCEO/Jrjq/
6+
B4Oqeu1B2izuq68u0fw4XW6YaycCzBOQGkAL6bnVjO8tD6x7Ds1t55spJLU0mzlw
7+
Vrcdne6WWI7vg10lvf9a1fhlfjbaFCI1C/XxCpvZk9lbluN92Qrz60EwHDaPO1bD
8+
GJOJmcmXAgMBAAECgf9sNVs/8WPmXUt8Uqdio0ZTkESP8h8424G/Vl05aPm25bXh
9+
p9V5Tlv2Hy7XI3PZBDkDcN0PHjZ7DSLTWzSiC7zI6Y0PgSPOPvBfeZSPaQcqZXkJ
10+
NW8Or4WQmdVT7iv8e21d/ZUQlttQR4HyHXxXDp1wTrdMlnk6rMHGOs4T3anL5ZY9
11+
juXeva/7ilyETvuGCogx4F8/jMpaG9ypr8HYUCwEtt2pEL1eak5VQ/U1wzoN5mKd
12+
Ke8eIfuE1JLdArFgXL9T3xmEu640JW27p94FTt6gUzutY6H88QvRy0S6A+Umat/A
13+
0sM3T0U3wZso0VI3wpgLScy+aKYz+NE+HWb74hkCgYEA7D3yhQ5iORs1o/ELdfJP
14+
j4pzaqyQ0fTjyXJ0BeCdbyvt6pKyEOVWr6N5tSb1LuoqHNO2qu/7pH6MjQMurT+U
15+
wQZ6i0DCSVedu5FFVA6udvtZ3hVyato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