-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
wasi-http: Allow setting TLS root certs for default_send_request
#8748
Comments
Do you want the ability to add a small list of certificates to the existing webpki-roots set, or add a list of system certificates?
The former would be good when adding a small number of certificates to the store, whereas the latter would be better when adding a large collection of root certificates. I am assuming we'd probably want to use |
Assuming we're going the route of "extend and/or replace", would it be better if the caller provided its own |
It looks like |
Okay great. That solves the "extend" part of the equation. Do we want to solve for replacement of the webpki-roots set? Would that be valuable to most callers of this function? Or would we just assume the caller should pass their own custom |
Maybe it can take an |
I have been exploring what it will take to implement this. one question I have is how do folks expect the additional root ca config to be passed.
The problem (with my limited understanding of how wasmtime works) with reference to a filename is that they may be different from the guest and host perspective. so I was thinking maybe passing a string representation of additional certs may work out better. but that would mean we are assuming that guest has access to the certs in the first place. do you have any suggestions/established-patterns about something like this? |
one additional functionality i am exploring while trying this out is to support so far I was thinking:
does this sound like a reasonable approach? |
Given the complexity of TLS configuration and the litany of options/formats I might throw another possibility into the ring which would be to keep the rustls bits we have right now as-is and require further customization to go through a different trait method such as: trait WasiHttpView {
fn sender(&mut self, tls: bool, authority: &str, timeout: Option<Duration>) -> Result<SendRequest<HyperOutgoingBody>>;
// ...
} While more difficult to integrate with that would expose the ability to make custom TCP connections using any TLS library. Additionally it would enable configurations such as pooling in theory. We'd need to refactor the |
That seems like it would probably account for roughly 50% of the existing default send impl: wasmtime/crates/wasi-http/src/types.rs Lines 277 to 369 in 0f48f93
I think its totally fine to say that client certs represent too much customization for this kind of common implementation. Given Spin's needs that originally motivated this issue I think we would be better off just forking the impl rather than introduce another trait method here. |
That's a good point yeah, and I agree with the conclusion that the best option here might be to copy what's currently done instead of having more hooks for customization (assuming that's ok for Spin of course) |
After finishing some refactoring around Spin's implementation of this, I'd like to consider adding a field to This would capture pretty much anything that a client would want to configure about TLS and should be easy to implement, basically just hooking in here: wasmtime/crates/wasi-http/src/types.rs Lines 355 to 361 in c8a5acd
The main downside is that it would strongly couple the interface to |
Given that the implementation already implies (Context: I just built an integration by overriding the default handler to proxy the plaintext to another part of the system which handles TLS, but |
Currently, the TLS roots are hard-coded to the
webpki-roots
set. This is a good default, but in some scenarios private roots are required. We should be able to add options toOutgoingRequestConfig
to extend and/or replace that default set of roots with custom root(s).Zulip context
The text was updated successfully, but these errors were encountered: