-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add global quarkus.tls.trust-all configuration property #9855
Conversation
I think the easiest way to fix this issue is to not use it as a default value and inject the config and deal with it in the code. @dmlloyd do you see any other way? I.e. would we be able to support default values in expansion? That's probably going to be complicated, right? |
We do support default values in expansion. If it is not working in some case, it is a bug. This should be covered in the "test extension" test. |
Thanks @dmlloyd, I'm going to check there how it is used. |
* {@link Verification}. Default is required. | ||
* Enable or disable certificate validation and hostname verification. Enable by default. | ||
* | ||
* @deprecated use quarkus.tls.trust-all instead |
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'm not sure it should be deprecated. There has to be an option for each extension to choose to differ from the global value. The example I suggested during the forum discussion: Vault is internal, OIDC server is not.
So I'd rename quarkus.oidc.tls.verification
to quarkus.oidc.tls.trust-all
(initialized by default to quarkus.tls.trust-all
as per your PR) without the deprecated tag (and similarly for the other extensions). We can then update the migration guide. And docs to recommend quarkus.tls.trust-all
but the users would still have an option to override it with quarkus.oidc.tls.trust-all
for OIDC or quarkus.vault.tls.trust-all
for Vault, etc...
After running some test, default value in expansion works when all properties are defined in the same class. |
Definitely a bug! The default values for properties are registered globally so they should always be available. There is one limitation: a build time property cannot default to an expression that expands to a run time property. However a run time property can default to an expression referencing a build time property. |
They are all runtime in my case. I will open an issue. |
The code which generates the class that resolves the configuration default values at run time is at line 934 of RunTimeConfigurationGenerator. It would be very strange indeed if crossing class boundaries somehow triggered a problem here though. Perhaps it's related to the recent move of property expansion from Quarkus to SmallRye Config though.
👍 |
01ecba5
to
6066b20
Compare
My bad, property expansion on default values works as expected, I haven't been able to create a reproducer. My problem seems to be related to the vault extension. I'm working on it. |
Hi All, by the way, should we also migrate all the existing It is not a big deal, but I guess the |
@sberyozkin I think we can put tls/ssl properties into the same namespace. |
I wonder if a better approach would be to produce a build item that would override the local configuration. I'm not entirely sure having a local configuration is a bad thing because you might want to disable certificates for a specific area while still checking the certificates elsewhere. Thus having trustAll undefined would make the local config authoritative and setting it to true would disable certificate checking everywhere. |
@gsmet I tried to create a quarkus/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/MailClientProducer.java Line 19 in 23c970a
right here: quarkus/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/MailClientProducer.java Line 109 in 23c970a
Could you help me to move forward? |
cfe3d0b
to
6d18886
Compare
@glefloch you would need to create a bean and inject it in the producer constructor. We have a few beans of this type called |
Build failed:
|
I spent a bit of time on this and pushed a new version of the code.
Instead of creating a builditem and a CDI bean, I only kept the |
Don't forget the REST Client extension. This may be related #12970 |
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.
LGTM
@sberyozkin would you be able to have a look at this one? |
@glefloch Sure, very sorry for a delay... |
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java
Outdated
Show resolved
Hide resolved
@glefloch I can take care of rebasing |
@sberyozkin I just rebased master and took care of it. Regarding the priority, actually, |
@glefloch Thanks, I did not realize |
@sberyozkin I updated the code so that extension properties have a higher priority compared to |
Hi @glefloch Thanks, it looks good IMHO as now we'd be able to use your single property plus as suggested somewhere earlier, if we have say Vault and Keycloak with different TLS trust requirements compared to the rest of the application, then we have it covered :-) |
@glefloch One more thing I'd like ask, maybe it can be done in a follow up PR, should we deprecate for OIDC (and other extensions) the extension specific properties, unless they are called
If you agree then I guess it would indeed be better to do it in a follow up PR and merge this PR first... |
@sberyozkin yes I think that could be easier for users to have a same semantic for config property. Once this one is merged, I will do that. |
5744ce3
to
618c3fe
Compare
Hi @glefloch Thanks, right now it is failing in the quarkus-arc deployment, can you please rebase again ? |
Yes I will do that. The previous error was a NPE because I was missing the default value for the Optional |
@sberyozkin it looks good with the rebase 🎉 |
@glefloch Thanks a million for keeping this PR alive and completed :-), please consider following up with renaming the extension specific properties |
This branch adds a global config property
quarkus.tls.trust-all
. Thus, extensions which needs a property to enable/disable tls verification could use it.There are some failed tests.
Here is the problem:
The
quarkus.tls.trust-all
property has a default value tofalse
.When configuring an other property (
quarkus.vault.tls.skip-verify
) as:This will end with an error resolving the property. But when setting
quarkus.tls.trust-all
property inapplication.properties
, the resolution will be ok.I think using
Optional
could fix it but it means handling default value in each extension.close #8975
close #12266