-
Notifications
You must be signed in to change notification settings - Fork 3k
Provide fluent API to set up the mutual TLS client authentication #48900
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 fluent API to set up the mutual TLS client authentication #48900
Conversation
This comment has been minimized.
This comment has been minimized.
🙈 The PR is closed and the preview is expired. |
Hmm, seems that in the DEV mode "after failed start" scenario config needs to be propagated from the recorder, I'll adjust logic accordingly. |
This comment has been minimized.
This comment has been minimized.
6db8a1d
to
fec9211
Compare
This comment has been minimized.
This comment has been minimized.
Hi @michalvavrik, thanks, PR looks good to me, as far as the iterative fluent API evolution is concerned. But, I'm not exactly sure if it gives an advantage, at this moment of time, over the configuration - where we still need to setup everything related to the actual MTLS mechanics. It only enables a switch for the client auth required, but MTLS is activated at the transport level even without this flag, without |
This comment has been minimized.
This comment has been minimized.
As far as advantage (or should we call this motivation) goes:
I am quite sure you are wrong. Can you rephrase this so that I can understand what you mean, please? There can be something I am missing. Without this PR you need to set
I understand what you try to say, that users need to configure TLS registry, but:
I am happy to follow-up with TLS registry. If you say that the way we provide TLS registry fluent API will change this API, maybe, in that case indeed I have no answer. |
Strictly speaking, I could add some support for adding certificates in this PR, but I really think it would be better to keep it small even for you, it must make reviews easier. |
fec9211
to
acd6aaf
Compare
This comment has been minimized.
This comment has been minimized.
Hi Michal I think it should be a draft, and we discuss |
This comment has been minimized.
This comment has been minimized.
Ok, turning it into a draft until you say it is ready. I also realized there already is Update: done, there is now a test and docs for programmatic TLS registry setup. |
acd6aaf
to
30167b1
Compare
Sure, I totally support this idea
Interesting, let me clarify here, do we still have a single instance of MTLS mechanism ? Or, given that the
Looks good indeed
Right, you need to set
I suppose what I'm trying to suggest is that we should think it out, we do not have to rush because the fluent API will be the most important Quarkus Security feature, so we have to think about all the variations. Adding one bit now, and then another one later might now work |
@michalvavrik Combining it with the TLS registry looks good |
Hello @cescoffier , this PR might still get some tiny changes (like docs tweaks if Sergey spots something), but I think the changes in |
extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/security/MTLS.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
84f9abf
to
3ef158b
Compare
3ef158b
to
841e3f6
Compare
This comment has been minimized.
This comment has been minimized.
Hi @michalvavrik @cescoffier, the API is marked as experimental so we can easily update it in 3.25.CR1 or even later to support more cases, and tune it as required. |
Right, for record, I made sure that this PR has no impact on cases when this fluent API is not used, so changes in |
This comment has been minimized.
This comment has been minimized.
I will have a deeper look - there are a few refactoring in vert.x HTTP that need a bit more scrutiny (switch from build time config to runtime, moving a method to retrieve the tls config to some security classes...) |
It would be great if we can finalize this before you go to PTO, otherwise considering Sergey's PTO, it will be hard to finalize this for 3.26. Thanks @cescoffier |
It's planned for tomorrow. |
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 had another look. My main concern is having the main HTTP utilities depending on security utilities.
|
||
import static io.quarkus.vertx.http.runtime.options.TlsUtils.computeKeyStoreOptions; | ||
import static io.quarkus.vertx.http.runtime.options.TlsUtils.computeTrustOptions; | ||
import static io.quarkus.vertx.http.runtime.security.HttpSecurityConfiguration.getHttpServerTlsConfigName; |
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 don't believe moving these to the HTTP security classes is correct. They are related to TLS and should be closed to the TLS handling.
Can these methods be moved here, or into a class that is TLS specific?
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 won't be without cost, because if I can't store programmatic TLS config on the security class, it means I'll have to create a new class that holds it (I mean that value that user configured), but it is not an issue for me. I'll move it.
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 have introduced HttpServerTlsConfig
which now holds TLS client auth and config name for the HTTP server. It is not completely decoupled from HTTP Security configuration because if users can configure TLS client auth and config by configuring MTLS, then we still need to make sure that HTTP Security config is ready, so this class still initialize HTTP Security config if it wasn't initialized already (which can only happen in DEV mode).
Hope it's better.
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.
Side note, I could make it bean if you prefer that. I avoided adding HTTP Security config to CDI because Martin Kouba warned me there could be theoretical circular dependency, but this HTTP Server TLS config is independent. Anyway, I think it is fine as on reload it is cleaned by a shutdown context.
841e3f6
to
7b09577
Compare
Status for workflow
|
Status for workflow
|
I think #49100 will bring merge conflicts, I'll resolve them once Clement is OK with this PR. |
@cescoffier Hi, how does it look to you now ? Note, we marked HttpSecurity Fluent API as experimental, so anything related to the Fluent API is changeable until it settles a bit and everyone is happy |
Great, thanks @cescoffier, I think this PR from @michalvavrik will make it more exciting for users to deal with (M)TLS, the HttpSecurity Fluent API is a work in progress, a good of number of incremental improvements yet to come, for CORS, CSRF, and the rest of it... |
Uh oh!
There was an error while loading. Please reload this page.