Closed ddewalle closed 8 months ago
Previous workaround is broken since Quarkus 1.5.1.Final (latest 1.7.1.Final too)
By adding '-Djavax.net.ssl.keyStore' in the previous workaround 'mvnw' command do not fix the problem anymore...
Is this a regression that appeared in version 1.5.1.Final? Or maybe I'm not doing it right? It is quite disconcerting. Is there another approach than the one I used? If so, a description in the QUARKUS - GUIDES would be helpful for SSL/TLS two-way.
However, the root of the problem remains relevant: why have to specify '-Djavax.net.ssl.keyStore' in the 'mvnw' command when 'quarkus.http.ssl.certificate.key-store-file' has been specified in the 'application.properties' file?
Environments
The previous regression has been introduced in 'quarkus-rest-client' 1.5.1-Final.
The class io.quarkus.restclient.runtime.RestClientBase directed me to this workaround because it uses 'Optional
In src/main/resources/application.properties of Foo server, add
org.acme.foo.BarService/mp-rest/keyStore=classpath:/foo.jks
org.acme.foo.BarService/mp-rest/keyStoreType = JKS
org.acme.foo.BarService/mp-rest/keyStorePassword = fooJksKeystorePass
The full file should be now:
quarkus.http.port = 8080
quarkus.http.ssl-port = 8433
quarkus.http.ssl.protocols = TLSv1.3
quarkus.http.ssl.certificate.key-store-file = foo.jks
quarkus.http.ssl.certificate.key-store-file-type = JKS
quarkus.http.ssl.certificate.key-store-password = fooJksKeystorePass
quarkus.http.ssl.certificate.trust-store-file = fooTrust.jks
quarkus.http.ssl.certificate.trust-store-file-type = JKS
quarkus.http.ssl.certificate.trust-store-password = fooJksTruststorePass
org.acme.foo.BarService/mp-rest/url=https://localhost:8434
org.acme.foo.BarService/mp-rest/keyStore=classpath:/foo.jks
org.acme.foo.BarService/mp-rest/keyStoreType = JKS
org.acme.foo.BarService/mp-rest/keyStorePassword = fooJksKeystorePass
mvnw compile quarkus:dev -Ddebug=false -Djavax.net.ssl.trustStore=<foo-server-path>/src/main/resources/fooTrust.jks -Djavax.net.ssl.trustStorePassword=fooJksTruststorePass
Environment for this final test
QUARKUS - HTTP REFERENCE and/or QUARKUS - USING THE REST CLIENT should really clearly address the subject which otherwise is a real headache. ;-)
And so, the root of the problem is now: why have to specify '.../mp-rest/keyStore' when 'quarkus.http.ssl.certificate.key-store-file' has been specified in the 'application.properties' file? Ok if it is to override the property but if not?
I also face the same issue where , Spring rest client take care everything if you give your JKS with your private key . where as quarkus has lot of issues .
Did a debug of io.vertx.mutiny.ext.web.client.HttpRequest, understand the Client keys are not pick up when making HTTP request
I am also facing the same issue.. thanks @ddewalle for opening it :-)
@ddewalle I added the following configuration in application.properties
and it doesn't work, but the mistake changed:
and Related debug logs: {"timestamp":"2022-03-25T08:41:37.574Z","sequence":1475,"loggerClassName":"org.jboss.resteasy.client.jaxrs.i18n.LogMessages_$logger","loggerName":"org.jboss.resteasy.client.jaxrs.i18n","level":"DEBUG","message":"RESTEASY004672: Client send processing failure."}
@cescoffier @geoand Can you please review this issue ?
@BarDweller do you want to have a look at this?
Pretty sure mTLS is supported. An up to date reproducer would be more than welcome.
Closing for lack of feedback
Describe the bug When running 2 quarkus servers communicating with SSL/TLS two-way between each other, the client key store is not properly managed.
To Reproduce Steps to reproduce the behavior:
Nota: all keys used here follow the chain
1.1. In src/main/java/org/acme/bar/BarResource.java, modify hello method to return "hello from bar"
import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
@Path("/bar") public class BarResource {
}
-----BEGIN CERTIFICATE----- MIIEjDCCA3SgAwIBAgICEAEwDQYJKoZIhvcNAQELBQAwajELMAkGA1UEBhMCRlIx DzANBgNVBAgMBkZyYW5jZTEUMBIGA1UEBwwLRm9vQmFyIENpdHkxDzANBgNVBAoM BkZPT0JBUjEPMA0GA1UECwwGRk9PQkFSMRIwEAYDVQQDDAlGT09CQVJfQ0EwHhcN MjAwNDAzMTk0MjA4WhcNMjEwNDAzMTk0MjA4WjBnMQswCQYDVQQGEwJGUjEPMA0G A1UECAwGRnJhbmNlMRQwEgYDVQQHDAtGb29CYXIgQ2l0eTEPMA0GA1UECgwGRk9P QkFSMQwwCgYDVQQLDANCQVIxEjAQBgNVBAMMCWxv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fVSY8OGc1aMAsHbzNPNAttaN27YRFIZpvMbNpCLp5pI5rsYk3XZU k8uKE1hP6KPPpRo5qorBj9ZWYBVkeRfCw7sIhwSpU75Dg27ZJDqFZwQdWozBhDgO Gd5H1lzjBMmFhOMowX1MrGVU2uZgk9bTAj8I2PmKXKJEvLz9nvdABKO6c8G+3ojT H51LGEKg4o29TLKwFeQvPIJZTUmTj4d9nOQM0GSWro82gsRsqYj31ha7DBWmabZW EPe5vBhyqHDj86uxyJv7PaSkiJSIqv/tDOpc07DYjmYPXIxXucKt7gHNlel8pM/0 0TgwxrTqqyyxHTmOD1C4yDkrSKC3DKIBxnyUC/07FVSG0ODpHL5B9wp2CaTYxJuA HjrcYyOEYGd9Ru9DNX330Ztjw6pGIQSCRq1M/z7H6VRbbMqvfkuXNCJqcD3/4xWq 06yHxyb6A65rCcXRl7s7yYofUR18jA0jByXoZWWLybv7A1/qvoz0db7j2WJfalH7 eXd9OWtgaE7oLAJIWzCSsx2pIWh2rQ7d2qZioew1UW/hFNTO8NOVoCC4f5qwWeGD xC0QmCyLBmqJLg7o2cjpHHSbeewByn3Np2MZPPF94oBWeOBd8IGwF+umXZJaZ4Lo ZPgnV7YJN7tH8HexLCWz35gE2//BsB5qFlaTOKbHoM96ouKAxX7/o2LLxkas2Y0F Y05iSlBGv6jQN4c2fCL4lxSuy5uHB3yPKjkuVAM0c/5wJ6NCyWEnrCCuRYhUC+Ny -----END RSA PRIVATE KEY-----
openssl pkcs12 -export -in bar.cert.pem -inkey bar.key.pem -out bar.p12 -name "BAR"
keytool -importkeystore -destkeystore bar.jks -deststorepass barJksKeystorePass -srckeystore bar.p12 -srcstoretype PKCS12 -srcstorepass barIdentityPass
At this point, we did not have already defined barTrust.jks
N.B. 'quarkus.http.ssl.protocols = TLSv1.3' is optional: the issue will be the same with TLSv1.2 but the trace will be different during debug
2.1. In src/main/java/org/acme/foo create BarService.java
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
@Path("/bar") @RegisterRestClient public interface BarService {
}
2.3. In src/main/resources
Create foo.cert.pem
Create foo.key.pem
UGem0SWBcxFJLjRDICkugGljflHcOx03xLPaPoblEUTv4dwj2quJ91gbeGgQGTMp Jp716aR5BjdBmHS0Ow0LKc7/MrswmEvf7aFvXu4b898g27/9VLGrVwE2csEeSV9N xSMpqbBt9zNKf6UpYAq7DxW3ZzZ5AWffQYwJ5a+aVEsZmJAWFPrzJYoOX9fkYWdv g+hcguUzgBsPKiUXS/mcC0KsjVVp4MNiWmKqyNsZI6sypIOcOzfZl/TbdFA8SRyP aLYFHowOoIsZu7hoybvmpY6OVaQLJ8ykdY8u+qNmaa44Jx12w6MtvSkEE56tlt6w YvWtbLNBswJUjXQWgxrz0eBG64AyzufQUvwEOw1RLI1wNfeBqK5cPbcigoIT+jHZ 2wLh99ykHFqClutv2btmhVF6R6gl2A+c3D9Ezgbz9CLkiaraC3m3Pm9CAZ3BT5YR o1yzKyewtl3Ftj3r2b2MdO10kcz/AStPxoyFu8iJlfL/Jgr9FecUued0Yl+FBEFa NWuaZf6FFdIPOGMk5pp9TERNQYjvms2ARDUXYJOHyMW4YxfDYSlEyQ4FdXX7zBcW TeYXBlVm7O1ooQ5yc4ljQgCBNIl77P29fTu/8FTTARyuPRRCNCWApigCAJEHuSv/ YL2pIW5mRNXZqMLx9ZdIRNoA9LUCVIDxHfV3tNJYtFVS0v6g4ojBaAeF68BKV9DB QNY4VBRzx2kaP1YT9v43TDLP8/zY6JVG5cNScAkhhCydrGk9JUgWLD7id3dyR83U u6sgwab6xqwog3TJIiludsJs+D6STJ/jhQBmoNdLFgDrjIcbdCpZYwLK5LU5WJoT 2H8DuqQoNQCsd4rg+LzAAWxGv58hmR0I/5ubjREzxLsOdUft5AVDTzM64z3adRiA BVqJX4JBAO5M/Ge+6PhWkIE5fXDvnfnugH2KTruektnado0hpKCSnZYYXtLnnDgC 6pfK4JVJIkiOTf2H3RpwdeN4gDWmZLi88QW6PcOhKqTamqXal2elTHXfIxhm4u28 hvLNY5BwWGD/f6hqZIKo2WIpx1fCbDzTX5KXbs2oHnx0UUnuCnOdGqEL/zFJVmhB TUv7PGngSI3HSMHFVq+PKjfpK7aJbaLwJGPV5vPBcHyl5mV/KcV+2tsiSQA5G16x XWun8PwOeD1QOY0RQQlYMzL4yRiEo3Rz8xJ3GeRAvhTxjUFww1SIjEi9aQgKvaom yWMr/8lfBVGVuMWNFu50MlDbj+FSlUntpQj3KPonH/B54aMU0Q4r9u9zN+W36Ujc h+8EGy3akyUDb6M4ofIkqxfSpHKwq6HnOgtNHIXNs+5dSBYc2l1QEKzDzKwI0DOc yS8SWJQAoPJBBZSDpyM1wFDRKEQUwKhFUu9TIPZiaYPq4jd8e5bhK2iRWi64wkE9 M3w6rT0EwPbyg+PPSXU/lNOzGcFxLiRD582ESKfV4Vhl029YXPqL4oem6gD2Zmqd 4QPWt35+Ime4F9EsnhP/2cS1HkJximUAqpiH1bMWvVHwUHx+qXvsTI2BLxAJMDst 85vyRwzg8U7g7QWVv/HAVJIv8tcdm7GkvXAeUZJPxbvP6/yWWNq0BEjpBjVixtLA -----END RSA PRIVATE KEY-----
openssl pkcs12 -export -in foo.cert.pem -inkey foo.key.pem -out foo.p12 -name "FOO"
keytool -importkeystore -destkeystore foo.jks -deststorepass fooJksKeystorePass -srckeystore foo.p12 -srcstoretype PKCS12 -srcstorepass fooIdentityPass
At this point, we did not have already defined fooTrust.jks
N.B. 'quarkus.http.ssl.protocols = TLSv1.3' is optional: the issue will be the same with TLSv1.2 but the trace will be different during debug
4.0. Build the 2 quarkus servers (without the tests)
4.1. Launch the 2 quarkus servers
bar-server: !!! Replace bar-server-path by the path to your bar project !!!
At this point, we add -Djavax.net.ssl.trustStore because the root certificate is self-signed (not a well-known certificate for the JVM)
foo-server: !!! Replace foo-server-path by the path to your foo project !!!
At this point, we add -Djavax.net.ssl.trustStore because the root certificate is self-signed (not a well-known certificate for the JVM)
What is expected
should return
What is the real result
Will result to an error on foo-server (as client of bar-server)
Behind the scene
Do not care here if you have an exception about 'io.vertx.core.VertxException: Thread blocked'
This is the real cause of the issue: the Produced client Certificate message should not have an empty certificate_list
Workaround
N.B. The value of 'javax.net.ssl.keyStore' is the same than the one specified in application.properties
The command
returns now the expected
Environment