-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
No TLS Session re-use when using Netty4ClientEngineFactory
(default)
#874
Comments
So, I don't believe you need to cache the As I mentioned in gitter, we mostly use ones which are tied to our internal security infrastructure. They create a single context and reuse it, because the parameters are known ahead of time. We also have one which precreates (some) contexts and then chooses the appropriate one based on the situation. I believe you would want something similar. I'm talking to the team now about seeing if we can/should open source that. |
Thank you for the example @ryanoneill. Caching the netty
Do you have any explanations for this? I had to copy some finagle private classes btw.
Can you share a bit more on why it is more "correct" and "safe" to use a context per connection instead of re-using it? Is it because settings might have been changed on either side since the last connection was established? |
No TLS Session re-use when using
Netty4ClientEngineFactory
(default)Expected behavior
When establishing a second connection between the same client and server instance the TLS sessions should be re-used.
Actual behavior
Each connection gets its own TLS session when configuring the client with
SslClientConfiguration
.Using the default
SslClientEngineFactory
leads to using theNetty4ClientEngineFactory
which has this behaviour. Configuring the sslcontext directly with.withTransport.tls(SSLContext)
leads to using theSslContextClientEngineFactory
which does work.Steps to reproduce the behavior
See testcases: https://github.com/spockz/finagle-tls-session-reuse/blob/master/src/test/scala/com/github/spockz/finagle/it/tls/TlsTest.scala, output:
Possible fixes
Failure(renegotiation unsupported..
. This appears to be because the engine is already destroyed.SslContextClientEngineFactory
mitigates the session issue, but this drops back to using JSSE for TLS which drops performance on JDK8 and loses H2.The text was updated successfully, but these errors were encountered: