-
Notifications
You must be signed in to change notification settings - Fork 420
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
Provide restricted TLS configurations #513
Conversation
Motivation: Providing TLS configuration is difficult without prior knowledge since one must provide the application protocols identifiers for ALPN. In addition the default minimum TLS version provided by NIOs TLSConfiguration is lower than that specified by the gRPC protococl. Modifications: Add TLS configuration for both server and client which defaults which better align to gRPC. Add shims marking the old APIs as deprecated. Result: TLS is easier to configure.
// TODO: Remove these shims before v1.0.0 is tagged. | ||
|
||
extension ClientConnection.Configuration { | ||
@available(*, deprecated, message: "use 'tls' and 'ClientConnection.Configuration.TLS'") |
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.
You can use a renamed:
attribute here to get Xcode to suggest a migration fixit
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 a different type (albeit a very similar one) instead of a direct rename so this seemed more appropriate
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.
Why not delete it altogether right away, given that we are not at 1.0 yet?
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.
We could, this makes it's easier to fix for anyone who is using the currently tagged version though.
// TODO: Remove these shims before v1.0.0 is tagged. | ||
|
||
extension ClientConnection.Configuration { | ||
@available(*, deprecated, message: "use 'tls' and 'ClientConnection.Configuration.TLS'") |
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.
Why not delete it altogether right away, given that we are not at 1.0 yet?
Sources/GRPC/TLSConfiguration.swift
Outdated
/// TLS configuration for a `ClientConnection`. | ||
/// | ||
/// Note that this configuration is a subset of `NIOSSL.TLSConfiguration` where certain options | ||
/// are removed from the users control to ensure the configuration complies with the gRPC |
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.
super-nit: user's
trustRoots: trustRoots, | ||
certificateChain: certificateChain, | ||
privateKey: privateKey, | ||
applicationProtocols: GRPCApplicationProtocolIdentifier.allCases.map { $0.rawValue } |
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.
Sorry, which identifiers does this include again?
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.
Off the top of my head: "h2" and "grpc-ext"
Motivation:
Providing TLS configuration is difficult without prior knowledge since
one must provide the application protocols identifiers for ALPN. In
addition the default minimum TLS version provided by NIOs
TLSConfiguration is lower than that specified by the gRPC protococl.
Modifications:
Add TLS configuration for both server and client which defaults which
better align to gRPC.
Add shims marking the old APIs as deprecated.
Result:
TLS is easier to configure.