Skip to content
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

Fix mTLS root cert store #222

Merged
merged 2 commits into from
Oct 9, 2023
Merged
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
22 changes: 13 additions & 9 deletions crates/lunatic-distributed/src/distributed/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,19 @@ where
match handle_spawn(ctx.clone(), spawn).await {
Ok(Ok(id)) => {
log::trace!("lunatic::distributed::server Spawned {id}");
ctx.node_client
.send_response(ResponseParams {
node_id: NodeId(node_id),
response: Response {
message_id: msg_id,
content: ResponseContent::Spawned(id),
},
})
.await?;
// The platform sends the spawn instructions with node_id = 0
// in this case we do not respond
if node_id != 0 {
ctx.node_client
.send_response(ResponseParams {
node_id: NodeId(node_id),
response: Response {
message_id: msg_id,
content: ResponseContent::Spawned(id),
},
})
.await?;
}
}
Ok(Err(client_error)) => {
log::trace!("lunatic::distributed::server Spawn error: {client_error:?}");
Expand Down
5 changes: 4 additions & 1 deletion crates/lunatic-distributed/src/quic/quin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@ pub fn new_quic_server(
}?;

let mut cert_chain = Vec::new();
for cert in certs {
for (i, cert) in certs.iter().enumerate() {
let mut cert = cert.as_bytes();
let cert = rustls_pemfile::read_one(&mut cert)?.unwrap();
let cert = match cert {
Item::X509Certificate(cert) => Ok(rustls::Certificate(cert)),
_ => Err(anyhow!("Not a valid certificate")),
}?;
if i != 0 {
roots.add(&cert)?;
}
cert_chain.push(cert);
}

Expand Down