-
Notifications
You must be signed in to change notification settings - Fork 564
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
[3x] TlsManager backport #7650
[3x] TlsManager backport #7650
Conversation
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.
I think this implementation currently does not work. It would not reload TLS right now, if I am not mistaken.
I will also take a closer look into whether we actually need to have those init
methods at all (for example on TlsManager) or whether it could be done without it. This will come in my next review.
webserver/webserver/src/main/java/io/helidon/webserver/NettyWebServer.java
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/WebServerTls.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Outdated
Show resolved
Hide resolved
...main/java/io/helidon/integrations/oci/tls/certificates/DefaultOciCertificatesTlsManager.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/TlsManager.java
Outdated
Show resolved
Hide resolved
* @return a new trust manager factory trusting all | ||
*/ | ||
protected TrustManagerFactory trustAllTmf() { | ||
return new TrustAllManagerFactory(); |
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.
This does not need to return new instance every time, since if I am not mistaken, it does not keep any internal state.
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.
Yea, sure, but it only is called once per config - so it really doesn't matter. And besides, this is the same code in v4.
* @param tlsConfig TLS configuration | ||
* @return secure random | ||
*/ | ||
protected SecureRandom secureRandom(WebServerTls tlsConfig) { |
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.
parameter is never used
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 is the same iface from v4 backported (except the type in v4 is TlsConfig
and not WebServerTls
. I kept it this way to be uniform, and also in the anticipation we do want to make it configurable as it is in v4.
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Show resolved
Hide resolved
if (explicitSslContext != null) { | ||
return explicitSslContext; | ||
} |
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.
Is this correct? Since sslContext is now moved to the TlsManager, everything regarding SSLContext should be taken from there. The reason why I am saying that is, that if SSL gets reloaded, but we had some explicit SSLContext at the beginning, this method will not be returning updated SSLContext. On the other hand, it might be what you want, but it would be strange since sslContext
method on TlsManager would be returning updated version.
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.
If someone explicitly sets the SSLContext
programmatically, we want to take it as-is. The ConfiguredTlsManager
should not be redefined from config as that would give a higher weight to config over the programmatic approach. What I can do is log a warning when programmatic is set and the OciTlsManager
is being used - because that is nonsensical.
@@ -163,6 +163,9 @@ class NettyWebServer implements WebServer { | |||
.childHandler(childHandler); | |||
|
|||
bootstraps.put(name, bootstrap); | |||
|
|||
// subscribe to updates | |||
soConfig.tls().ifPresent(tlsConfig -> updateTls(tlsConfig, name)); |
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.
This does not subscribe to updates. This actually registers yet another tls and overwrites the one created few lines above :-)
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.
See last commit.
Should be all addressed now in the last couple of commits. |
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.
What I found right now, are more less minor changes.
However, I would definitely recommend to check whether this new approach with manager will work correctly also when updateTls
method is used. This method was designed to work with completely new WebServerTls.
Basically what I am asking about is:
- to check whether this method is compatible with this new approach
- try to use it with combination of this new way of reloading
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Outdated
Show resolved
Hide resolved
webserver/webserver/src/main/java/io/helidon/webserver/ConfiguredTlsManager.java
Outdated
Show resolved
Hide resolved
Here is a breakdown of the two ways to update today: The updateTls() flow:
The manager::reload() flow:
Analysis
However, in V4 we have "reloadable key stores and trust stores", and that is what tls managers are mutating while preserving the SSLContext instance to be steady. Its in V3 where we don't do it this way (i.e., no single SSLContext with any notion of reloadable components, etc.). So the net summary here is that we need to either assume the configuration for these two configuration elements (session cache size and timeout) must remain steady an immutable, or else we will need to do more in this PR to allow for a new My advice is to assume these configuration attributes are assumed to be immutable and everything is fine as it is now. |
This addresses #7544 (base issue #7279) - TlsManager w/ an OCI Certificates service integration for 3.x.
There are some notable changes between this version and the 4.x version:
TlsManager
contract has a few variations - the additional methods are marked deprecated.InjectionServices
.