Support session cache for client and server when using native SSLEngi…#10331
Support session cache for client and server when using native SSLEngi…#10331normanmaurer merged 1 commit into4.1from
Conversation
|
Depends on netty/netty-tcnative#548 |
c33d76d to
7e8856a
Compare
idelpivnitskiy
left a comment
There was a problem hiding this comment.
Looks promising, great work!
Will do a second review pass later
handler/src/main/java/io/netty/handler/ssl/NullOpenSslSession.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/ExtendedOpenSslSession.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslClientContext.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslClientContext.java
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionCache.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslServerContext.java
Show resolved
Hide resolved
|
@idelpivnitskiy PTAL again |
d92883c to
c57927a
Compare
|
@netty-bot test this please |
idelpivnitskiy
left a comment
There was a problem hiding this comment.
LGTM, awesome work!
A few minor comments and questions:
handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java
Outdated
Show resolved
Hide resolved
handler/src/main/java/io/netty/handler/ssl/OpenSslClientSessionCache.java
Show resolved
Hide resolved
| context.setSessionCacheSize((int) Math.min(sessionCacheSize, Integer.MAX_VALUE)); | ||
| } | ||
| if (sessionTimeout > 0) { | ||
| context.setSessionTimeout((int) Math.min(sessionTimeout, Integer.MAX_VALUE)); |
There was a problem hiding this comment.
Should we throw if the requested sessionCacheSize/sessionTimeout is higher than Integer.MAX_VALUE? Or at least log it? Silent override may be confusing.
There was a problem hiding this comment.
this is the same code we use for the JDK implementation. Let me think about it and make a follow up if needed to keep it consistent.
| try { | ||
| doHandshakeVerifyReusedAndClose("a.netty.io", 9999, false); | ||
| // As we have a cache size of 1 we should never have more then one session in the cache | ||
| doHandshakeVerifyReusedAndClose("b.netty.io", 9999, false); |
There was a problem hiding this comment.
Can we verify that a single session available in cache is reused for a.netty.io?
| // the handshake is done. | ||
| // See https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_sess_set_get_cb.html | ||
| if (!SslUtils.PROTOCOL_TLS_V1_3.equals(engine.getSession().getProtocol())) { | ||
| assertEquals(isReused, engine.isSessionReused()); |
There was a problem hiding this comment.
I probably miss it somewhere, but how do you know if the session was reused via session ticket, not session id for TLSv1.2?
|
@netty-bot test this please |
|
Factored out some bug fix in another PR that is not really related to this one #10388 |
c943882 to
e1bcbd5
Compare
|
@netty-bot test this please |
e1bcbd5 to
220ec3f
Compare
730f023 to
f8be4b2
Compare
|
@netty-bot test this please |
|
Once this build passes I will merge this one in.... |
…ne implementation Motivation: At the moment we don't support session caching for client side when using native SSLEngine implementation and our implementation of SSLSessionContext is incomplete. Modification: - Consume netty-tcnative changes to be able to cache session in an external cache - Add and adjust unit tests to test session caching - Add an in memory session cache that is hooked into native SSLEngine Result: Support session caching on the client and server side
bc3568e to
de9c85b
Compare
…ne implementation (#10331) Motivation: At the moment we don't support session caching for client side when using native SSLEngine implementation and our implementation of SSLSessionContext is incomplete. Modification: - Consume netty-tcnative changes to be able to cache session in an external cache - Add and adjust unit tests to test session caching - Add an in memory session cache that is hooked into native SSLEngine Result: Support session caching on the client and server side
* '4.1' of github.com:netty/netty: Support session cache for client and server when using native SSLEngine implementation (netty#10331) Simple fix typo (netty#10403) Eliminate a redundant method call in HpackDynamicTable.add(...) (netty#10399) jdk.tls.client.enableSessionTicketExtension must be respected by OPENSSL and OPENSSL_REFCNT SslProviders (netty#10401)
* '4.1-read' of github.com:Kvicii/netty: (43 commits) Make the TLSv1.3 check more robust and not depend on the Java version… (netty#10409) Reduce the scope of synchronized block in PoolArena (netty#10410) Add IndexOutOfBoundsException error message (netty#10405) Add default handling for switch statement (netty#10408) Review PooledByteBufAllocator in respect of jemalloc 4.x changes and update allocate algorithm.(netty#10267) Support session cache for client and server when using native SSLEngine implementation (netty#10331) Simple fix typo (netty#10403) Eliminate a redundant method call in HpackDynamicTable.add(...) (netty#10399) jdk.tls.client.enableSessionTicketExtension must be respected by OPENSSL and OPENSSL_REFCNT SslProviders (netty#10401) 重新编译4.1分支 [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release netty-4.1.51.Final Correctly return NEED_WRAP if we produced some data even if we could not consume any during SSLEngine.wrap(...) (netty#10396) Modify OpenSSL native library loading to accommodate GraalVM (netty#10395) Update to netty-tcnative 2.0.31.Final and make SslErrorTest more robust (netty#10392) Add option to HttpObjectDecoder to allow duplicate Content-Lengths (netty#10349) Add detailed error message corresponding to the IndexOutOfBoundsException while calling getEntry(...) (netty#10386) Do not report ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify as blocking call (netty#10387) Add unit test for HpackDynamicTable. (netty#10389) netty用于测试的内嵌Channel | ChannelInboundHandler主要方法 ...
…ne implementation (netty#10331) Motivation: At the moment we don't support session caching for client side when using native SSLEngine implementation and our implementation of SSLSessionContext is incomplete. Modification: - Consume netty-tcnative changes to be able to cache session in an external cache - Add and adjust unit tests to test session caching - Add an in memory session cache that is hooked into native SSLEngine Result: Support session caching on the client and server side
…ne implementation
Motivation:
At the moment we don't support session caching for client side when using native SSLEngine implementation and our implementation of SSLSessionContext is incomplete.
Modification:
Result:
Support session caching on the client and server side