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

Please provide a feature flag to use webpki-roots rather than native roots #658

Closed
joshtriplett opened this issue May 20, 2021 · 4 comments

Comments

@joshtriplett
Copy link
Contributor

Feature Request

Crates

tonic

Motivation

I'd like to build a static binary, which will be deployed to a system that doesn't have any system TLS roots. I'd like to compile in webpki-roots, rather than using rustls-native-roots.

Proposal

I'd love to have a feature flag (something like tls-webpki-roots) that enables the use of webpki-roots rather than rustls-native-roots. That feature flag could enable an optional webpki-roots dependency, and feed the webpki-roots certificates into rustls.

I'd be happy to supply a pull request implementing this proposal, if it sounds like a reasonable approach.

@joshtriplett
Copy link
Contributor Author

I'm currently working around this by doing the following:

        let mut rustls_config = rustls::ClientConfig::new();
        rustls_config
            .root_store
            .add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
        rustls_config.alpn_protocols = vec![b"h2".to_vec()];
        let tonic_tls_config = tonic::transport::ClientTlsConfig::new().rustls_client_config(rustls_config);

This seems cumbersome, requires matching the version of rustls used by tonic and the version of webpki-roots used by rustls, and requires dealing with internal details like setting alpn_protocols.

@davidpdrsn
Copy link
Member

We actually do the exact same thing at Embark so I think it makes to add this to tonic.

@LucioFranco what do you think?

@joshtriplett
Copy link
Contributor Author

I wrote a PR for this: #660

@joshtriplett
Copy link
Contributor Author

Closing this since #660 has been merged.

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

No branches or pull requests

2 participants