Skip to content

(WIP) : HTTPS support for manufacturing-server and manufacturing-client for DI #579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 132 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions admin-tool/src/aio/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pub(super) struct Configuration {
pub listen_ip_address: String,

#[clap(long, default_value_t = 8080)]
pub listen_port_manufacturing_server: u16,
pub listen_port_http_manufacturing_server: u16,
#[clap(long, default_value_t = 8084)]
pub listen_port_https_manufacturing_server: u16,
#[clap(long, default_value_t = 8081)]
pub listen_port_owner_onboarding_server: u16,
#[clap(long, default_value_t = 8082)]
Expand Down Expand Up @@ -77,7 +79,8 @@ impl Default for Configuration {
cert_country: String::from("US"),

listen_ip_address: String::from("0.0.0.0"),
listen_port_manufacturing_server: 8080,
listen_port_http_manufacturing_server: 8080,
listen_port_https_manufacturing_server: 8084,
listen_port_owner_onboarding_server: 8081,
listen_port_rendezvous_server: 8082,
listen_port_serviceinfo_api_server: 8083,
Expand Down Expand Up @@ -253,7 +256,8 @@ fn generate_configs(aio_dir: &Path, config_args: &Configuration) -> Result<(), E
path: aio_dir.join("stores").join("manufacturing_sessions"),
},

bind: get_bind(config_args.listen_port_manufacturing_server)?,
bind_http: get_bind(config_args.listen_port_http_manufacturing_server)?,
bind_https: get_bind(config_args.listen_port_https_manufacturing_server)?,

ownership_voucher_store_driver: StoreConfig::Directory {
path: aio_dir.join("stores").join(if config_args.separate_manufacturing_and_owner_voucher_store {
Expand Down Expand Up @@ -293,7 +297,9 @@ fn generate_configs(aio_dir: &Path, config_args: &Configuration) -> Result<(), E
device_cert_ca_private_key: AbsolutePathBuf::new(aio_dir.join("keys").join("device_ca_key.der")).unwrap(),
device_cert_ca_chain: AbsolutePathBuf::new(aio_dir.join("keys").join("device_ca_cert.pem")).unwrap(),
owner_cert_path: Some(AbsolutePathBuf::new(aio_dir.join("keys").join("owner_cert.pem")).unwrap()),
}
manufacturing_server_https_cert: AbsolutePathBuf::new(aio_dir.join("keys").join("manufacturing_server_https_cert.crt")).unwrap(),
manufacturing_server_https_key: AbsolutePathBuf::new(aio_dir.join("keys").join("manufacturing_server_https_key.key")).unwrap(),
},
};
write_config(
aio_dir,
Expand Down
2 changes: 1 addition & 1 deletion admin-tool/src/aio/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn manufacture_device(
"MANUFACTURING_SERVER_URL",
format!(
"http://localhost:{}", //DevSkim: ignore DS137138
configuration.listen_port_manufacturing_server
configuration.listen_port_http_manufacturing_server
),
)
.env("DI_MFG_STRING_TYPE", "serialnumber")
Expand Down
2 changes: 1 addition & 1 deletion admin-tool/src/aio/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl ChildBinary {

fn port(&self, config: &Configuration) -> u16 {
match self {
ChildBinary::ManufacturingServer => config.listen_port_manufacturing_server,
ChildBinary::ManufacturingServer => config.listen_port_http_manufacturing_server,
ChildBinary::OwnerOnboardingServer => config.listen_port_owner_onboarding_server,
ChildBinary::RendezvousServer => config.listen_port_rendezvous_server,
ChildBinary::ServiceInfoApiServer => config.listen_port_serviceinfo_api_server,
Expand Down
5 changes: 3 additions & 2 deletions client-linuxapp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async fn get_client_list(rv_entry: &RendezvousInterpretedDirective) -> Result<Ve
service_client_list.push(fdo_http_wrapper::client::ServiceClient::new(
ProtocolVersion::Version1_1,
url,
));
)?);
}
log::trace!("Client list: {:?}", service_client_list);
Ok(service_client_list)
Expand Down Expand Up @@ -855,7 +855,8 @@ async fn perform_to2(
) -> Result<bool> {
log::info!("Performing TO2 protocol, URL: {:?}", url);

let mut client = fdo_http_wrapper::client::ServiceClient::new(ProtocolVersion::Version1_1, url);
let mut client =
fdo_http_wrapper::client::ServiceClient::new(ProtocolVersion::Version1_1, url)?;

let nonce5 = match get_nonce(MessageType::TO1RVRedirect).await {
Ok(nonce5) => nonce5,
Expand Down
2 changes: 1 addition & 1 deletion http-wrapper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ warp-sessions = { version = "1.0", optional = true }
time = "0.3"

# Client-side
reqwest = { version = "0.11", optional = true, features = ["native-tls", "json"] }
reqwest = { version = "0.11.21", optional = true, features = ["native-tls", "json", "__tls"] }
url = { version = "2", optional = true }

[features]
Expand Down
Loading