-
Notifications
You must be signed in to change notification settings - Fork 37
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
🎚 Use rustls for https directly, for more control #100
Conversation
The CLI performs backend health checks on startup. Previously it was setting up its own TLS connector, but this commit changes it to use the same connector we use in viceroy-lib (now called `BackendConnector`) to ensure consistency and centralize any connector changes.
Rather than using hyper_rustls as before, this approach gives us more direct control over how TLS is connected and configured, including things like SNI and ALPN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wonderful, wonderful work @aturon.
great job ✨ ✔️
lib/src/session.rs
Outdated
/// The TLS configuration for this execution. | ||
/// | ||
/// Populated prior to guest execution, and never modified. | ||
pub(crate) tls_config: Arc<rustls::ClientConfig>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) tls_config: Arc<rustls::ClientConfig>, | |
tls_config: Arc<rustls::ClientConfig>, |
because we mention that this is never modified in the comment, perhaps we can remove the pub(crate)
visibility here, to help enforce that?
that leaves the tls_config
accessor below as the sole interface through which other modules can acquire a reference to this 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this is one of those "take it or leave it" comments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh good catch, i was following the pattern of the other read-only items. they should all be using accessors rather than pub(crate)
, so I'll add a commit to do that 👍
@cratelyn pushed up a commit tidying up the privacy for read-only session fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 ✨ 😻
Previous work (#75) moved Viceroy to using rustls for TLS, with some good benefits. However, the hyper_rustls library bakes in a fair amount of TLS configuration that we need to control more directly.
Since hyper_rustls is a very thin library, and since we already need our own Hyper connector for other reasons, I opted to just use rustls directly within Viceroy, for maximum clarity/control. The main downside is that there's a bit of boilerplate around TCP/TLS streams.
Along the way, this PR also refactors the CLI backend health checks to use the Viceroy library, rather than connecting in its own way, which will help ensure we keep those in sync.
I've confirmed that this PR:
Fixes #91
Fixes #96