Skip to content

feat: implement nested tls#5

Merged
0x416e746f6e merged 4 commits intomainfrom
feat/nested-tls
Mar 11, 2026
Merged

feat: implement nested tls#5
0x416e746f6e merged 4 commits intomainfrom
feat/nested-tls

Conversation

@0x416e746f6e
Copy link
Copy Markdown
Member

This PR implements nested TLS primitives + actix wrappers (accessible via actix feature).

@0x416e746f6e 0x416e746f6e requested a review from ameba23 March 10, 2026 09:56
@0x416e746f6e 0x416e746f6e self-assigned this Mar 10, 2026
Copy link
Copy Markdown
Collaborator

@ameba23 ameba23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 The nested TLS implementation is great, as is the performance benchmarking setup.

Im less familiar with the actix related stuff but i can't see any issues.

One possible issue:

Should this library be crypto provider agnostic? I think that by adding rustls / tokio-rustls with default features enabled we implicitly enable aws-lc-rs

Comment thread crates/nested-tls/Cargo.toml
}

let Some(fut) = this.fut.as_pin_mut() else {
panic!("unexpected polling state: missing handshake future")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can never happen right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless something is really wrong, no

#[inline]
pub fn connect<IO>(
&self,
domain: rustls::pki_types::ServerName<'static>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any possible use-cases where you would want a different name for the inner and outer sessions?

I can't think of any.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean this assumes that the hostname we want to connect to is the same on the inner session and the outer session.

For our use case, the outer session would use a domain name and the inner session would be self-signed or private-ca-signed, and we can choose what to set the SAN to. Using the same name for both means that the inner session (attested-tls crate) needs to know the domain name used by the outer session.

I don't think this is an issue - but maybe there are some edge cases where we would need a different hostname for inner and outer session.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, got it. no, I also can not imagine use-case when inner and outer certs would have to have different CNs. some of the SANs might be different, though. for example, the outer, CA-signed cert might have just public FQDN, but the inner certs might have the public CN (same as outer) + SAN for each of the individual VMs serving.

but from the client perspective it would be just FQDN, same for both certs


fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
<ConnectorService as Service<ConnectInfo<Uri>>>::poll_ready(&self.tcp, cx)
.map_err(|err| ConnectError::Resolver(Box::new(err)))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error variant indicates the hostname could not be resolved. is that actually the case here or is this just a way to wrap the error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@0x416e746f6e
Copy link
Copy Markdown
Member Author

Should this library be crypto provider agnostic? I think that by adding rustls / tokio-rustls with default features enabled we implicitly enable aws-lc-rs

good point. pushed 0d84afe

@0x416e746f6e 0x416e746f6e merged commit 27e4eee into main Mar 11, 2026
@0x416e746f6e 0x416e746f6e deleted the feat/nested-tls branch March 11, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants