-
Notifications
You must be signed in to change notification settings - Fork 263
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
factor-outbound-networking: Add support for client TLS #2703
Conversation
f6692dc
to
64ca67e
Compare
64ca67e
to
8585f6d
Compare
@rajatjindal FYI |
@rylev I'll be particularly interested in your thoughts on the RuntimeConfig approach. |
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
8585f6d
to
c7a7319
Compare
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.
These are copied from spin-trigger-http
tests.
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.
I've got lots of nits, but this looks good overall 🎉
// Validate hostname | ||
http::uri::Authority::from_str(host).with_context(|| format!("invalid TLS 'host' {host:?}"))?; | ||
if host.contains(':') { | ||
anyhow::bail!("invalid TLS 'host' {host:?}; ports not currently supported"); |
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.
It's not clear to me why ports aren't supported. What would happen if this check were removed?
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.
The behavior didn't seem obvious enough to me to roll it into a refactor.
fn deserialize_hosts<'de, D: Deserializer<'de>>(deserializer: D) -> Result<Vec<String>, D::Error> { | ||
let hosts = Vec::<String>::deserialize(deserializer)?; | ||
for host in &hosts { | ||
validate_host(host).map_err(serde::de::Error::custom)?; |
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.
If we're going to validate the host later, is there really a need for it here?
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.
Validating here gives nice TOML errors.
Signed-off-by: Lann Martin <lann.martin@fermyon.com>
Port the
[[client_tls]]
runtime config logic fromspin-trigger
tospin-factor-outbound-networking
.This rewords the keys used in that runtime config section, which is a breaking change but I think its less confusing and worth it given that ~no one is using it yet and it will be released with 3.0.
This also switch from using
Authority
to a plain string for hostnames. UsingAuthority
was my idea but I realize now that it makes things awkward when trying to deal with port numbers, so I bailed out to just plainhost: String
, though still usingAuthority
's parser to validate that string.The
rustls::ClientConfig
derived from this runtime config is exposed to dependent factors viaInstanceBuilder::component_tls_configs
.