-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Expose granular control of TLS configuration for OpenSSL and Rustls #47
Comments
@jen20 Thank you for writing this detailed issue up! I think you are 100% correct on your ideas. This would be super handy to include. Just thinking about this now, something that is kinda done in What do you think about that? |
Fixed by #48. |
Feature Request
Crates
tonic
Motivation
Currently a small subset of of the configuration options available for OpenSSL or Rustls are exposed by the builder API, via the
openssl_tls
andrustls_tls
functions:openssl_tls
for servers andrustls_tls
for clients)openssl_tls
for servers andrustls_tls
for clients)Clearly many more configuration points exist in each of the supported TLS libraries which are not exposed. If these are needed, users lose the benefit of the 'batteries included' nature of the
transport
implementations which are part of Tonic.Proposal
Currently the TLS library in use can be switched out in Tonic by enabling the appropriate Cargo feature, and changing the method name called from the builder - the arguments are compatible for each.
Wrapping every available option in a cross-TLS library compatible way in this way could lead to a sprawling API, and there may still be divergence between libraries. Instead, it would be better to allow the native configuration structure from each library to be passed into the builders:
rustls::ServerConfig
andrustls::ClientConfig
for Rustlsopenssl::ssl::SslAcceptorBuilder
andopenssl::ssl::SslConnectorbuilder
for OpenSSL.This does add considerable complexity though, and there are some cases where the existing mechanism is sufficient - so it is desirable to keep the simpler interface for those that prefer that.
It's probably better for these different mechanisms for configuring TLS to be mutually exclusive with one another - that is, it should not be possible to pass in both a
ServerConfig
and anIdentity
. Consequently, I propose making the existing methods on the builder take an enumeration instead, with separate variants for each configuration mechanism.Alternatives
An alternative to the enumeration is to have builder methods for each configuration mechanism and ensure via some other mechanism that they are not used together. This seems more complex to me, though there is currently not much in the way of precedent for the style suggested above in the builder API so this might be preferable.
The text was updated successfully, but these errors were encountered: