From f45535dd6928faafdddd6a2e7896dc859e09ff58 Mon Sep 17 00:00:00 2001 From: cstdev Date: Thu, 17 Oct 2019 15:19:07 +0000 Subject: [PATCH 1/6] Add option to configure the engine to require/request client authentication. --- .../io/quarkus/vertx/http/runtime/ServerSslConfig.java | 8 ++++++++ .../io/quarkus/vertx/http/runtime/VertxHttpRecorder.java | 1 + 2 files changed, 9 insertions(+) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java index 526ba667bac60..08ec9669bbf49 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ServerSslConfig.java @@ -5,6 +5,7 @@ import io.quarkus.runtime.annotations.ConfigGroup; import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.DefaultConverter; +import io.vertx.core.http.ClientAuth; /** * Shared configuration for setting up server-side SSL. @@ -29,4 +30,11 @@ public class ServerSslConfig { @ConfigItem(defaultValue = "TLSv1.3,TLSv1.2") public List protocols; + /** + * Configures the engine to require/request client authentication. + * NONE, REQUEST, REQUIRED + */ + @ConfigItem(defaultValue = "NONE") + public ClientAuth clientAuth; + } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 2083218ece802..88251c9bbddce 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -357,6 +357,7 @@ private static HttpServerOptions createSslOptions(HttpConfiguration httpConfigur serverOptions.setSsl(true); serverOptions.setHost(httpConfiguration.host); serverOptions.setPort(httpConfiguration.determineSslPort(launchMode)); + serverOptions.setClientAuth(sslConfig.clientAuth); return serverOptions; } From b6825dd069d4240b0b41703baa437c4978b8710f Mon Sep 17 00:00:00 2001 From: cstdev Date: Fri, 18 Oct 2019 12:39:35 +0000 Subject: [PATCH 2/6] Enable setting of truststore path, type and password --- .../vertx/http/runtime/CertificateConfig.java | 19 ++++++ .../vertx/http/runtime/VertxHttpRecorder.java | 60 ++++++++++++++++--- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java index b98701ae25330..a465eef97e34e 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CertificateConfig.java @@ -41,4 +41,23 @@ public class CertificateConfig { */ @ConfigItem(defaultValue = "password") public String keyStorePassword; + + /** + * An optional trust store which holds the certificate information of the certificates to trust + */ + @ConfigItem + public Optional trustStoreFile; + + /** + * An optional parameter to specify type of the trust store file. If not given, the type is automatically detected + * based on the file name. + */ + @ConfigItem + public Optional trustStoreFileType; + + /** + * A parameter to specify the password of the trust store file. + */ + @ConfigItem + public Optional trustStorePassword; } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 88251c9bbddce..bb70fcaa2ba6d 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -296,6 +296,8 @@ private static HttpServerOptions createSslOptions(HttpConfiguration httpConfigur final Optional keyFile = sslConfig.certificate.keyFile; final Optional keyStoreFile = sslConfig.certificate.keyStoreFile; final String keystorePassword = sslConfig.certificate.keyStorePassword; + final Optional trustStoreFile = sslConfig.certificate.trustStoreFile; + final Optional trustStorePassword = sslConfig.certificate.trustStorePassword; final HttpServerOptions serverOptions = new HttpServerOptions(); serverOptions.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); setIdleTimeout(httpConfiguration, serverOptions); @@ -309,13 +311,7 @@ private static HttpServerOptions createSslOptions(HttpConfiguration httpConfigur if (keyStoreFileType.isPresent()) { type = keyStoreFileType.get().toLowerCase(); } else { - final String pathName = keyStorePath.toString(); - if (pathName.endsWith(".p12") || pathName.endsWith(".pkcs12") || pathName.endsWith(".pfx")) { - type = "pkcs12"; - } else { - // assume jks - type = "jks"; - } + type = findKeystoreFileType(keyStorePath); } byte[] data = getFileContent(keyStorePath); @@ -343,6 +339,22 @@ private static HttpServerOptions createSslOptions(HttpConfiguration httpConfigur return null; } + if (trustStoreFile.isPresent()) { + if (!trustStorePassword.isPresent()) { + throw new IllegalArgumentException("No trust store password provided"); + } + final String type; + final Optional trustStoreFileType = sslConfig.certificate.trustStoreFileType; + final Path trustStoreFilePath = trustStoreFile.get(); + if (trustStoreFileType.isPresent()) { + type = trustStoreFileType.get().toLowerCase(); + } else { + type = findKeystoreFileType(trustStoreFilePath); + } + createTrustStoreOptions(trustStoreFilePath, trustStorePassword.get(), type, + serverOptions); + } + for (String cipher : sslConfig.cipherSuites) { if (!cipher.isEmpty()) { serverOptions.addEnabledCipherSuite(cipher); @@ -386,6 +398,40 @@ private static void createPemKeyCertOptions(Path certFile, Path keyFile, serverOptions.setPemKeyCertOptions(pemKeyCertOptions); } + private static void createTrustStoreOptions(Path trustStoreFile, String trustStorePassword, + String trustStoreFileType, HttpServerOptions serverOptions) throws IOException { + byte[] data = getFileContent(trustStoreFile); + switch (trustStoreFileType) { + case "pkcs12": { + PfxOptions options = new PfxOptions() + .setPassword(trustStorePassword) + .setValue(Buffer.buffer(data)); + serverOptions.setPfxTrustOptions(options); + break; + } + case "jks": { + JksOptions options = new JksOptions() + .setPassword(trustStorePassword) + .setValue(Buffer.buffer(data)); + serverOptions.setTrustStoreOptions(options); + break; + } + default: + throw new IllegalArgumentException( + "Unknown truststore type: " + trustStoreFileType + " valid types are jks or pkcs12"); + } + } + + private static String findKeystoreFileType(Path storePath) { + final String pathName = storePath.toString(); + if (pathName.endsWith(".p12") || pathName.endsWith(".pkcs12") || pathName.endsWith(".pfx")) { + return "pkcs12"; + } else { + // assume jks + return "jks"; + } + } + private static byte[] doRead(InputStream is) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; From c4384c61b5e0f03f50c69a562ee29ea151627cef Mon Sep 17 00:00:00 2001 From: cstdev Date: Tue, 22 Oct 2019 16:15:36 +0000 Subject: [PATCH 3/6] Add test for Mutual TLS Also allow the SSL URL to be injected into tests that need it. --- .../vertx/http/ssl/SslServerWithJksTest.java | 8 +++--- .../vertx/http/ssl/SslServerWithP12Test.java | 8 +++--- .../vertx/http/ssl/SslServerWithPemTest.java | 8 +++--- .../src/main/resources/application.properties | 7 ++++- .../src/main/resources/server-keystore.jks | Bin 0 -> 1964 bytes .../src/main/resources/server-truststore.jks | Bin 0 -> 1278 bytes .../it/vertx/VertxProducerResourceTest.java | 24 ++++++++++++++++-- .../src/test/resources/client-keystore.jks | Bin 0 -> 1959 bytes .../src/test/resources/client-truststore.jks | Bin 0 -> 1284 bytes .../test/common/http/TestHTTPResource.java | 6 +++++ .../common/http/TestHTTPResourceManager.java | 22 +++++++++++++--- 11 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 integration-tests/vertx-http/src/main/resources/server-keystore.jks create mode 100644 integration-tests/vertx-http/src/main/resources/server-truststore.jks create mode 100644 integration-tests/vertx-http/src/test/resources/client-keystore.jks create mode 100644 integration-tests/vertx-http/src/test/resources/client-truststore.jks diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithJksTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithJksTest.java index 462663c6ed5c4..bcd8f2527995d 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithJksTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithJksTest.java @@ -3,7 +3,6 @@ import static org.hamcrest.core.Is.is; import java.io.File; -import java.net.MalformedURLException; import java.net.URL; import javax.enterprise.context.ApplicationScoped; @@ -18,11 +17,15 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; +import io.quarkus.test.common.http.TestHTTPResource; import io.restassured.RestAssured; import io.vertx.ext.web.Router; public class SslServerWithJksTest { + @TestHTTPResource(value = "/ssl", ssl = true) + URL url; + @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) @@ -41,8 +44,7 @@ public static void restoreRestAssured() { } @Test - public void testSslServerWithJKS() throws MalformedURLException { - URL url = new URL("https://localhost:8444/ssl"); + public void testSslServerWithJKS() { RestAssured.get(url).then().statusCode(200).body(is("ssl")); } diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithP12Test.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithP12Test.java index 42fbe50c14c96..5cf9f63c0983c 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithP12Test.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithP12Test.java @@ -3,7 +3,6 @@ import static org.hamcrest.core.Is.is; import java.io.File; -import java.net.MalformedURLException; import java.net.URL; import javax.enterprise.context.ApplicationScoped; @@ -18,11 +17,15 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; +import io.quarkus.test.common.http.TestHTTPResource; import io.restassured.RestAssured; import io.vertx.ext.web.Router; public class SslServerWithP12Test { + @TestHTTPResource(value = "/ssl", ssl = true) + URL url; + @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) @@ -41,8 +44,7 @@ public static void restoreRestAssured() { } @Test - public void testSslServerWithPkcs12() throws MalformedURLException { - URL url = new URL("https://localhost:8444/ssl"); + public void testSslServerWithPkcs12() { RestAssured.get(url).then().statusCode(200).body(is("ssl")); } diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithPemTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithPemTest.java index b6b24dc0f279f..c91cbd06b305a 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithPemTest.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ssl/SslServerWithPemTest.java @@ -3,7 +3,6 @@ import static org.hamcrest.core.Is.is; import java.io.File; -import java.net.MalformedURLException; import java.net.URL; import javax.enterprise.context.ApplicationScoped; @@ -18,11 +17,15 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; +import io.quarkus.test.common.http.TestHTTPResource; import io.restassured.RestAssured; import io.vertx.ext.web.Router; public class SslServerWithPemTest { + @TestHTTPResource(value = "/ssl", ssl = true) + URL url; + @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) @@ -42,8 +45,7 @@ public static void restoreRestAssured() { } @Test - public void testSslServerWithPem() throws MalformedURLException { - URL url = new URL("https://localhost:8444/ssl"); + public void testSslServerWithPem() { RestAssured.get(url).then().statusCode(200).body(is("ssl")); } diff --git a/integration-tests/vertx-http/src/main/resources/application.properties b/integration-tests/vertx-http/src/main/resources/application.properties index 426541279ba0c..a93e6337fd2e6 100644 --- a/integration-tests/vertx-http/src/main/resources/application.properties +++ b/integration-tests/vertx-http/src/main/resources/application.properties @@ -1 +1,6 @@ -vertx.event-loops.size=2 \ No newline at end of file +vertx.event-loops.size=2 +quarkus.http.ssl.certificate.key-store-file=server-keystore.jks +quarkus.http.ssl.certificate.key-store-password=password +quarkus.http.ssl.certificate.trust-store-file=server-truststore.jks +quarkus.http.ssl.certificate.trust-store-password=password +quarkus.http.ssl.client-auth=REQUIRED diff --git a/integration-tests/vertx-http/src/main/resources/server-keystore.jks b/integration-tests/vertx-http/src/main/resources/server-keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..544ed8f1311d85b3feeef2c97bd15905c634845f GIT binary patch literal 1964 zcmchX`8(8$7so&InT0V8hAz_BY8WG#&x~b^!Yvfp8$HN!m8EeJWrS@G+e^Cf7%+R81eA%AHxlvJUd04V-p9qZgf!o@$!uDmyj<71WmDw zSH9T9ubqSM79&Fi&epWKHq`X>u!)h#m&hxZ&omk+{;uZczMi=tMES&X=UA!6%DF4- zKUKnPPwE77Q|p=aQldvpgVLTadrSXTC{|8pNUdBM$g!`Evfn%bt8i7TyMM;bYkHuo z=jRudOWkg**%v;WNRV;B7xDP=l85s0#ORT;nS+69r9AscTXm+q(Yu0`2E9M#M2g)r z&5sbz8*|GH*kf9vJ*0y(auvD5R{e^%I!4L}3Z!OF@ut@+UC*>28)7iW?v%NsT@F1c zcky}~V{IW*8Ru0c=+oaWIc+BQtF=plxSQ0@Va_J&P6k7kOW`R->G4Q_-iKdnRGii&L5e&wsS zk4*6VJcHHWmr=32;rL^rrYMjg(XyLd%X)RF_0vBu`IhOePj;-%N`cqX)gf(>C!l{-Ym~-YzP{ zK1*=!h{28so>mRI&q$d@IL!a~bHcFFhJxsYCcb!MM!K?E)6|RijN=<)?+*mGJdCd4 z%2%mmES`6rda}qMjI_GYJ}L1G^iHzJ32o#EgOh08$VsG_-W_Vq*ZRFG!NwDqYZX)A zXaR6rL45Ilwsq3dh3Ei)XocbsO(GwNVyO^Bp>D+w{BMScgPUxfuP#bN zBgwo|9|79}bubPF132NjL-lv~&+ZCRe(SQZul=IcQn0U*Ciii!IZMgtFFn+(iG5kK zoHqRtdbX(o&&a)X*d?(WSN^CbJUPT7!PoVkIA{9MNI_ORPl!Y^yiN1FBC;CrwhJNfrj8<(kPRu^)&8G3Cv+1g*ZHzDO z6V)$lwws%^FG8hJ|6IO+u9KzQ|juZY;G51 z69N`zJ0h?;!v;EG&mH=wOB(kQw8m|-W)v;E(~ms4$Du7&kKdrg_3lqM>F^?_00%q- zYwhR<%I9w7QA>$Shm9^L=N2{3nm$pEb+CHq5~HbiN$Ivx{{_B{1ecjcJ$TVItU0Xp z5|UVlzi!Zg!AxkHGPCHjeVwckNqO%(dyLdHkOFQeFDM>1Uyc6u%V?cL0>y6^b@T({eIH)gIF=l&bK7(8sf313Wg@&rTdS@Vp>z`CIu!k6Q5*9M&WTV6!60=DVtvXFMT99 zYHC-zlAZ1Q!g~|+yKFPrPWOg1qI)W}^8*;x40l+4%Gm5H&nCG$?^G8?igW?N>cz+% zL=Dy9d?Be?^35<3-(X>}PFrhqZ`bSF*~9cbtP|_x9$~TXc>6%a8hRmoj=s$rntCn! zYx(C7gZ3#F@{hH`XD&Of>h^B8Ft6^cNw06XoyU{Y$hpva>#`ST&3(xDeZn{GG`~&0 z_mmMkXrOGVWxjg7n^ekP(LHxo!?zLaB=6jp)_YNw(SF3|iR8ABS`k_n5d1M6(Mu8z z$Z8IV^&#lYmiCZxP30a|ze*sI?d)J%=E4w~TqQPOnVh<~&dm8@6-WtE*t&29afA$F zyNJzL*J|`f&0hQ42PWgKEV}DDRR8s2;Kl&7AH<*j>xu9#?F}jvsm6*S-p5XQ6Cd48i;t+Tr7e73F_b%L I`uuU!-;J0^H2?qr literal 0 HcmV?d00001 diff --git a/integration-tests/vertx-http/src/main/resources/server-truststore.jks b/integration-tests/vertx-http/src/main/resources/server-truststore.jks new file mode 100644 index 0000000000000000000000000000000000000000..b09ca9dc9054d8bb54c3f1adbd5dcf37b4ce45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5zY*ETb%y2T4!L95>+8Nq?@IOFvFeZY@8efGIw!eErE#~g-0~3J z`2AwqMC+TJv$U@r-g;8Q`-%3p{Z{K!=6ADIw@ryWqB!x;?O&>D2NuX3%zj%DGGF*s zNj~2}*~Ge2<@;5P?58xPtPy>BSziCsV!6U=+L-~DrtW2SfAlxctNPuy2Yr3Ki(FXP zZkVxV#vIq2kh0^}k5`Ko4de}EfmvIYk420{M7^?JV9i34*&X&1bLKVe7MsXkt&LW; zFgq|9*aDMS|AGA~ew(#cKU}Oc(M|Be|I$OdMf&r+*KO8goz5gv+VbFh?N`_Tx4PyE rotpcjYU$yt2YC8#%BS*7JG*h_UCs%g0{=U1(=@$vQA+9E-<6sGxo!tH literal 0 HcmV?d00001 diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java index b4016a9e545eb..d0f326a136988 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java @@ -1,17 +1,26 @@ package io.quarkus.it.vertx; import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; +import java.net.URL; + import org.junit.jupiter.api.Test; +import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; + +import io.restassured.builder.RequestSpecBuilder; +import io.restassured.specification.RequestSpecification; @QuarkusTest public class VertxProducerResourceTest { + @TestHTTPResource(ssl = true) + URL url; + @Test public void testInjection() { get("/").then().body(containsString("vert.x has been injected")); @@ -19,7 +28,7 @@ public void testInjection() { @Test public void testInjectedRouter() { - RestAssured.given().contentType("text/plain").body("Hello world!") + given().contentType("text/plain").body("Hello world!") .post("/").then().body(is("Hello world!")); } @@ -28,4 +37,15 @@ public void testRouteRegistration() { get("/my-path").then().body(containsString("OK")); } + @Test + public void testRouteRegistrationMTLS() { + RequestSpecification spec = new RequestSpecBuilder() + .setBaseUri(String.format("%s://%s", url.getProtocol(), url.getHost())) + .setPort(url.getPort()) + .setKeyStore("client-keystore.jks", "password") + .setTrustStore("client-truststore.jks", "password") + .build(); + given().spec(spec).get("/my-path").then().body(containsString("OK")); + } + } diff --git a/integration-tests/vertx-http/src/test/resources/client-keystore.jks b/integration-tests/vertx-http/src/test/resources/client-keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..0ccfb70750c4eabf00ac75170b9218cab5c37481 GIT binary patch literal 1959 zcmchX`8(8$7sqGD$1tRFEtN1xF}C^4*mqgNTfBs* zKwK1;2w(hJ%iKsgNP?Au2jK$Ba3}y(f(b*Rybyo{OQV$EbgoKm2@Z);-7xDwdWPU1 ziyFmthIgSZ0;N3~gx3{1(lz;}K@`LNcK^wNHM(xkj>EjQpPAS$7@`ev^zD0;JJ`eM zvj)S`PR%TO-D2aI;F~SnUfb0MyZO809|I>CABsZ|!6OPXVTarX z%3H&g8P8oWRtDrT%$3s;JzX90%AG~g9K{J7kw(!{UF-+x(<`Qz+*f4VyV`4Sb6 zucWG>XHD1XCb@%HHlpyoiCz|5gibPT#2pLGR6iI@g#{{f^0JPTnPUd5p+=5heOT^g zEeod_i0#c9WB-U>1C|&|U3uuh#tAni!fw_ul$v?ZY3VH7zPIYtg`WeC(B*_ZQ?fb7j?_n{qTCcWI#dH zdKJ4sDI-v2=Uf-$rQPcYD#hNOHocvczvGEdN0ZGu^~V)m_bW#h>eEq!Qpc^&=^mqH zBQN+~HqZ3@mOvW`VOrPLYq4yR(-|)g%^CkTTAapotM&DYvnY0MH04_#@#qsU;cLp9 z4Wz~5))Vd+fK%=hcKr#doCzbBpNb_pIKbw~;wbFu>Et>G{{xO?pJT?8<$Sy)G*rL7 z&tv^}Z(Y?eTX=W5GeS=$tME%;)zlJpnwQK#9bx+gM$CVL);47 zWF8T?Zx9|AOa!Hm2w`+FAQp?kVzf1M+>QugK@fxG+TZvubU@-UWvNn z<$@xN1cgF!qBKXJJ!H4ma#DXEus+xHMXmFWex3Hwk4yAIq|vSxe9`P&4gILPE)B8R z@mSKKVojcf2BK^aA9TiL(`Hg8 z{JqTZl_@1K3Jc0~suibKV8#g+^MGtM}4saxd4>0|G8u+~D!Cxh*b)Ajjv%IWrV zGno>o%4^dX%FU*1{PzK}(a3=Ki5VA0N*6!-x~wEqs`o@+unr$?Q|^Q5ODkL6a9v$* z$#<7vQjq42!s?{RZ_`tYTbFtwx|3G1f2cRl$F)5l!FzIN1QDIS4zG(hJCf?Du(LGK@D+~F+h>^y&J5&~sjWtd8h@?k$W$`LdC2#4q z2nx=qmVBYKt?rBaj{bHxBQ@=YxrD!9A~0qpR{!m-f3E&0;+FEeKO1`#ZRV7lTJ`Gu?q#}qu0g4Grcx#MjPT%oSVxO!PO#161~uLy zm}FQYYv9^fi~X_m(w}-uH-E4CbENG+&L|Rhps@cu^;i%q{%I&Zq_kD$7Yk{_5az~z E0AS=^5C8xG literal 0 HcmV?d00001 diff --git a/integration-tests/vertx-http/src/test/resources/client-truststore.jks b/integration-tests/vertx-http/src/test/resources/client-truststore.jks new file mode 100644 index 0000000000000000000000000000000000000000..f072e6db68abd0a257b6e9ce8a8cf65dc17a65c6 GIT binary patch literal 1284 zcmezO_TO6u1_mY|W(3o$xs}~W=SQC%O%WGl3H8><8ni}LIwgL#mvH-Ir+(nIT`uIB?fZhyoQ#B z21Z7PMux^F=27CjMg|6kMnDAS(#H`^%+3Z)Or~t?T5TTZELa$U91W%>Mn;DIO4FM= zSH0Z7`fW$mdC$OYpY@K;vtDm5@#58yY4Ub|&Dfqh2d+FKVQjgB^ZB85GQqQ#yGOTP z5L~-sOJ#ehXG>jn9pH zw@=z`aDC@v&q)0Y&KX6bmZGn0v%B4bj~To6H&`1jIrQLD(FD~zKl?6g4vU3H0-ikV zk z{dtOWvqIVOIY!IWKe^jYY@fa8$a9yy3XLH?TcaCv%zEWl*j?#->BqkyqtD2xE2iQ| z#j##i_3bjVtafvAKh$x_m}dF>^0|`R0#d1~wA;V=WT@S?JFf2?Id^ zch@rsYV*o7-7=VNr1DRF-L3Aq-kM4`cXdCWck?0hGMk`A?qeO>AH8)Jd-z`b_C4k% zMm7d;V(Ivwa^*xCf4`dAl=JP8ftM>UwOE|@pV}R<=B8HN#r4K>bAx?@;}~~#+<$&D z`H;k_JF0JPFEV9#`=hHyQe8{+*4$s38wIZ4VwKtL>G{X}=YhCWW|yTeW@NgXG)BZ# zds;`Gx?25{^G)R|OCDc?$7jW})_#0?EwIB=YL8y!vxyNuOfQLedTczmWx~$gE9UHy z(3;tKY5ByI{-1F-?eDhyHtx&*|1$NlU3bCNm7k8j-uUN&=CbbZre#H1nFpB8=}TMp zUFs4KKIN6RSAeH<8@u^5hT<0!ST1S)x+<=7mFqH#WyaA{rE7H*E|y$T%xCS64DnwX z9sJ9Aiu!KejQ;IS=cc}1tY{!_APdalvV1IJEF$cF_s{>Rd!chFaE0TeW*^TB+fS>a z6*0{A36AF@lGefzZDlOIbZL}ipZSEbIb++TDk=j literal 0 HcmV?d00001 diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResource.java b/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResource.java index 1ec6663fa389f..db9ed0d427955 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResource.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResource.java @@ -22,4 +22,10 @@ * @return The path part of the URL */ String value() default ""; + + /** + * + * @return If the URL should use the HTTPS protocol and SSL port + */ + boolean ssl() default false; } diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResourceManager.java b/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResourceManager.java index 6d80e24f349d9..104000e22dcd6 100644 --- a/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResourceManager.java +++ b/test-framework/common/src/main/java/io/quarkus/test/common/http/TestHTTPResourceManager.java @@ -20,6 +20,14 @@ public static String getUri() { return "http://" + host + ":" + port + contextPath; } + public static String getSslUri() { + Config config = ConfigProvider.getConfig(); + String host = config.getOptionalValue("quarkus.http.host", String.class).orElse("localhost"); + String port = config.getOptionalValue("quarkus.http.test-ssl-port", String.class).orElse("8444"); + String contextPath = config.getOptionalValue("quarkus.servlet.context-path", String.class).orElse(""); + return "https://" + host + ":" + port + contextPath; + } + public static void inject(Object testCase) { Map, TestHTTPResourceProvider> providers = getProviders(); Class c = testCase.getClass(); @@ -34,10 +42,18 @@ public static void inject(Object testCase) { } String path = resource.value(); String val; - if (path.startsWith("/")) { - val = getUri() + path; + if (resource.ssl()) { + if (path.startsWith("/")) { + val = getSslUri() + path; + } else { + val = getSslUri() + "/" + path; + } } else { - val = getUri() + "/" + path; + if (path.startsWith("/")) { + val = getUri() + path; + } else { + val = getUri() + "/" + path; + } } f.setAccessible(true); try { From d73f97b5ad616a49d042b8bc5f940d3238bb0cc9 Mon Sep 17 00:00:00 2001 From: cstdev Date: Mon, 28 Oct 2019 16:33:32 +0000 Subject: [PATCH 4/6] Add jks as resource for native tests --- integration-tests/vertx-http/pom.xml | 7 +++++++ .../vertx-http/src/main/resources/resources-config.json | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 integration-tests/vertx-http/src/main/resources/resources-config.json diff --git a/integration-tests/vertx-http/pom.xml b/integration-tests/vertx-http/pom.xml index c6b276a8aa757..ee50b48162214 100644 --- a/integration-tests/vertx-http/pom.xml +++ b/integration-tests/vertx-http/pom.xml @@ -97,7 +97,14 @@ true true + + + -H:ResourceConfigurationFiles=${project.basedir}/src/main/resources/resources-config.json + -H:EnableURLProtocols=http,https + ${graalvmHome} + true + true diff --git a/integration-tests/vertx-http/src/main/resources/resources-config.json b/integration-tests/vertx-http/src/main/resources/resources-config.json new file mode 100644 index 0000000000000..fc0791cae1361 --- /dev/null +++ b/integration-tests/vertx-http/src/main/resources/resources-config.json @@ -0,0 +1,7 @@ +{ + "resources": [ + { + "pattern": ".*\\.jks$" + } + ] +} \ No newline at end of file From c2afb43e8be9be446532db76f32e4121ec48baf9 Mon Sep 17 00:00:00 2001 From: cstdev Date: Tue, 29 Oct 2019 12:34:05 +0000 Subject: [PATCH 5/6] Use correct ports for MTLS native test Native runs in prod profile and so doesn't use the set test ports, need to explicitly use the same port as would be used in prod. Currently hardcoded though. Use different method to include resources, specify all jks rather than using resource file. Fix import order Correct algorithm used in keystores, can't use DSA in Java 11+ --- integration-tests/vertx-http/pom.xml | 2 +- .../src/main/resources/resources-config.json | 7 ------- .../src/main/resources/server-keystore.jks | Bin 1964 -> 2215 bytes .../src/main/resources/server-truststore.jks | Bin 1278 -> 925 bytes .../it/vertx/VertxProducerResourceIT.java | 19 +++++++++++++++++- .../it/vertx/VertxProducerResourceTest.java | 2 ++ .../src/test/resources/client-keystore.jks | Bin 1959 -> 2214 bytes .../src/test/resources/client-truststore.jks | Bin 1284 -> 925 bytes 8 files changed, 21 insertions(+), 9 deletions(-) delete mode 100644 integration-tests/vertx-http/src/main/resources/resources-config.json diff --git a/integration-tests/vertx-http/pom.xml b/integration-tests/vertx-http/pom.xml index ee50b48162214..eef1a2e2f7c98 100644 --- a/integration-tests/vertx-http/pom.xml +++ b/integration-tests/vertx-http/pom.xml @@ -99,7 +99,7 @@ true - -H:ResourceConfigurationFiles=${project.basedir}/src/main/resources/resources-config.json + -H:IncludeResources=.*\.jks -H:EnableURLProtocols=http,https ${graalvmHome} diff --git a/integration-tests/vertx-http/src/main/resources/resources-config.json b/integration-tests/vertx-http/src/main/resources/resources-config.json deleted file mode 100644 index fc0791cae1361..0000000000000 --- a/integration-tests/vertx-http/src/main/resources/resources-config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "resources": [ - { - "pattern": ".*\\.jks$" - } - ] -} \ No newline at end of file diff --git a/integration-tests/vertx-http/src/main/resources/server-keystore.jks b/integration-tests/vertx-http/src/main/resources/server-keystore.jks index 544ed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O z6V)$lwws%^FG8hJ|6IO+u9KzQ|juZY;G51 z69N`zJ0h?;!v;EG&mH=wOB(kQw8m|-W)v;E(~ms4$Du7&kKdrg_3lqM>F^?_00%q- zYwhR<%I9w7QA>$Shm9^L=N2{3nm$pEb+CHq5~HbiN$Ivx{{_B{1ecjcJ$TVItU0Xp z5|UVlzi!Zg!AxkHGPCHjeVwckNqO%(dyLdHkOFQeFDM>1Uyc6u%V?cL0>y6^b@T({eIH)gIF=l&bK7(8sf313Wg@&rTdS@Vp>z`CIu!k6Q5*9M&WTV6!60=DVtvXFMT99 zYHC-zlAZ1Q!g~|+yKFPrPWOg1qI)W}^8*;x40l+4%Gm5H&nCG$?^G8?igW?N>cz+% zL=Dy9d?Be?^35<3-(X>}PFrhqZ`bSF*~9cbtP|_x9$~TXc>6%a8hRmoj=s$rntCn! zYx(C7gZ3#F@{hH`XD&Of>h^B8Ft6^cNw06XoyU{Y$hpva>#`ST&3(xDeZn{GG`~&0 z_mmMkXrOGVWxjg7n^ekP(LHxo!?zLaB=6jp)_YNw(SF3|iR8ABS`k_n5d1M6(Mu8z z$Z8IV^&#lYmiCZxP30a|ze*sI?d)J%=E4w~TqQPOnVh<~&dm8@6-WtE*t&29afA$F zyNJzL*J|`f&0hQ42PWgKEV}DDRR8s2;Kl&7AH<*j>xu9#?F}jvsm6*S-p5XQ6Cd48i;t+Tr7e73F_b%L I`uuU!-;J0^H2?qr diff --git a/integration-tests/vertx-http/src/main/resources/server-truststore.jks b/integration-tests/vertx-http/src/main/resources/server-truststore.jks index b09ca9dc9054d8bb54c3f1adbd5dcf37b4ce45a3..8ec8e126507b61e0e602b71d9f67b3d7e3c7cae3 100644 GIT binary patch literal 925 zcmezO_TO6u1_mY|W(3o$xs}0Ue&dE&8D>0B0 z=QXr6G&C?YG&M3ZGLI7HHL^4`0AdK2=Jq!+Dj|EBk(GhDiIJbdpox)-sfm%1VUF3s zo}9*=J}DCyv6d_>miqhX+0BER7vzr=weLB0SI~-EN4Tx;+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(odEjZ+&mH$#~b(h68)9X2t@;h(T;wOoW0*K!IN=)8gsj zEW9SStV}8nhFp2F^nk94-UI(>&*Z!>Oz_&frr-SC#s~8an=aW*a6X-)-@)LR@b>2^ z&dmyC%jXy^Q~%^{H?e*8q9e~;_9`@n_-u`C&@tRr>>ZaBNfMb zS=G18%(B|e&HYfvC1aZ9^ULQ-ZVO1IuF`J*=98gz+wQo&cj(M!?=5dP=+{hmxn$bq zrLn=$um8AS`6l_z-uCV8c1zVmpHv={8*1jRXn!N;?(w7Ucl^EWAuWd4N=Emd2H#!J zB&f|R&veURx{=C1^>w$p=Xz@@-Q3mvc;3y2%*$+o8o7^kY=89DS?u9^@!R*9n;2Oc zKmozRaoU^HA_VhLHh09-0V5>EKv$Cc@p8JZy-4nsT z?ay7g`1FVU?8)~F{db%@lkxk@cE!ZS6XfNTf4^&USl<4rDQ2+-SL>ByN_h;I!cub= zIlp?wyJ700g*Tp5zY*ETb%y2T4!L95>+8Nq?@IOFvFeZY@8efGIw!eErE#~g-0~3J z`2AwqMC+TJv$U@r-g;8Q`-%3p{Z{K!=6ADIw@ryWqB!x;?O&>D2NuX3%zj%DGGF*s zNj~2}*~Ge2<@;5P?58xPtPy>BSziCsV!6U=+L-~DrtW2SfAlxctNPuy2Yr3Ki(FXP zZkVxV#vIq2kh0^}k5`Ko4de}EfmvIYk420{M7^?JV9i34*&X&1bLKVe7MsXkt&LW; zFgq|9*aDMS|AGA~ew(#cKU}Oc(M|Be|I$OdMf&r+*KO8goz5gv+VbFh?N`_Tx4PyE rotpcjYU$yt2YC8#%BS*7JG*h_UCs%g0{=U1(=@$vQA+9E-<6sGxo!tH diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java index f5c9009658985..6b544f107015a 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java @@ -1,8 +1,25 @@ package io.quarkus.it.vertx; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.containsString; + +import org.junit.jupiter.api.Test; + import io.quarkus.test.junit.NativeImageTest; +import io.restassured.builder.RequestSpecBuilder; +import io.restassured.specification.RequestSpecification; @NativeImageTest public class VertxProducerResourceIT extends VertxProducerResourceTest { -} \ No newline at end of file + @Test + public void testRouteRegistrationMTLS() { + RequestSpecification spec = new RequestSpecBuilder() + .setBaseUri(String.format("%s://%s", url.getProtocol(), url.getHost())) + .setPort(8443) + .setKeyStore("client-keystore.jks", "password") + .setTrustStore("client-truststore.jks", "password") + .build(); + given().spec(spec).get("/my-path").then().body(containsString("OK")); + } +} diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java index d0f326a136988..2a5e572ea7a47 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java @@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test; import io.quarkus.test.common.http.TestHTTPResource; +import io.quarkus.test.junit.DisabledOnNativeImage; import io.quarkus.test.junit.QuarkusTest; import io.restassured.builder.RequestSpecBuilder; @@ -37,6 +38,7 @@ public void testRouteRegistration() { get("/my-path").then().body(containsString("OK")); } + @DisabledOnNativeImage @Test public void testRouteRegistrationMTLS() { RequestSpecification spec = new RequestSpecBuilder() diff --git a/integration-tests/vertx-http/src/test/resources/client-keystore.jks b/integration-tests/vertx-http/src/test/resources/client-keystore.jks index 0ccfb70750c4eabf00ac75170b9218cab5c37481..cf6d6ba454864d18322799afac37f520673193d6 100644 GIT binary patch literal 2214 zcmcJQ`8O2&9>-_54#_?lreR2^8EGsf5m^giEKx+VWCk-tSu%>TFQG7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pc^&=^mqH zBQN+~HqZ3@mOvW`VOrPLYq4yR(-|)g%^CkTTAapotM&DYvnY0MH04_#@#qsU;cLp9 z4Wz~5))Vd+fK%=hcKr#doCzbBpNb_pIKbw~;wbFu>Et>G{{xO?pJT?8<$Sy)G*rL7 z&tv^}Z(Y?eTX=W5GeS=$tME%;)zlJpnwQK#9bx+gM$CVL);47 zWF8T?Zx9|AOa!Hm2w`+FAQp?kVzf1M+>QugK@fxG+TZvubU@-UWvNn z<$@xN1cgF!qBKXJJ!H4ma#DXEus+xHMXmFWex3Hwk4yAIq|vSxe9`P&4gILPE)B8R z@mSKKVojcf2BK^aA9TiL(`Hg8 z{JqTZl_@1K3Jc0~suibKV8#g+^MGtM}4saxd4>0|G8u+~D!Cxh*b)Ajjv%IWrV zGno>o%4^dX%FU*1{PzK}(a3=Ki5VA0N*6!-x~wEqs`o@+unr$?Q|^Q5ODkL6a9v$* z$#<7vQjq42!s?{RZ_`tYTbFtwx|3G1f2cRl$F)5l!FzIN1QDIS4zG(hJCf?Du(LGK@D+~F+h>^y&J5&~sjWtd8h@?k$W$`LdC2#4q z2nx=qmVBYKt?rBaj{bHxBQ@=YxrD!9A~0qpR{!m-f3E&0;+FEeKO1`#ZRV7lTJ`Gu?q#}qu0g4Grcx#MjPT%oSVxO!PO#161~uLy zm}FQYYv9^fi~X_m(w}-uH-E4CbENG+&L|Rhps@cu^;i%q{%I&Zq_kD$7Yk{_5az~z E0AS=^5C8xG diff --git a/integration-tests/vertx-http/src/test/resources/client-truststore.jks b/integration-tests/vertx-http/src/test/resources/client-truststore.jks index f072e6db68abd0a257b6e9ce8a8cf65dc17a65c6..112fb9857fbd71c688d2bdd6ea2bf647790def70 100644 GIT binary patch literal 925 zcmezO_TO6u1_mY|W(3o$xs}cI8JL?G`56qF7`d357#SJb>>3m5 zZ=H#Lv+59Q`XPs%cW*|zcHdloqAxePpx)#s-v#GfEiaLcc0X6@y`H-%=v#*1=Oe7K z)qW-B>_$?)l+O%qOP zY5r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WW|yTeW@NgXG)BZ# zds;`Gx?25{^G)R|OCDc?$7jW})_#0?EwIB=YL8y!vxyNuOfQLedTczmWx~$gE9UHy z(3;tKY5ByI{-1F-?eDhyHtx&*|1$NlU3bCNm7k8j-uUN&=CbbZre#H1nFpB8=}TMp zUFs4KKIN6RSAeH<8@u^5hT<0!ST1S)x+<=7mFqH#WyaA{rE7H*E|y$T%xCS64DnwX z9sJ9Aiu!KejQ;IS=cc}1tY{!_APdalvV1IJEF$cF_s{>Rd!chFaE0TeW*^TB+fS>a z6*0{A36AF@lGefzZDlOIbZL}ipZSEbIb++TDk=j From 4aa4e70c360eb9f0aa4e80ad7a4342a0dffc4a7c Mon Sep 17 00:00:00 2001 From: cstdev Date: Fri, 15 Nov 2019 10:04:07 +0000 Subject: [PATCH 6/6] Work around SunEC warning --- .../it/vertx/VertxProducerResourceIT.java | 19 +++++++++++++++++++ .../it/vertx/VertxProducerResourceTest.java | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java index 6b544f107015a..b5266645a691e 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceIT.java @@ -3,6 +3,11 @@ import static io.restassured.RestAssured.given; import static org.hamcrest.Matchers.containsString; +import java.security.Provider; +import java.security.Security; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import io.quarkus.test.junit.NativeImageTest; @@ -12,6 +17,20 @@ @NativeImageTest public class VertxProducerResourceIT extends VertxProducerResourceTest { + private static Provider sunECProvider; + + @BeforeAll + public static void setupSecProvider() { + //Remove SunEC provider for the test as it's not being provided for tests. + sunECProvider = Security.getProvider("SunEC"); + Security.removeProvider("SunEC"); + } + + @AfterAll + public static void restoreSecProvider() { + Security.addProvider(sunECProvider); + } + @Test public void testRouteRegistrationMTLS() { RequestSpecification spec = new RequestSpecBuilder() diff --git a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java index 2a5e572ea7a47..857a1fb011a26 100644 --- a/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java +++ b/integration-tests/vertx-http/src/test/java/io/quarkus/it/vertx/VertxProducerResourceTest.java @@ -12,7 +12,6 @@ import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.DisabledOnNativeImage; import io.quarkus.test.junit.QuarkusTest; - import io.restassured.builder.RequestSpecBuilder; import io.restassured.specification.RequestSpecification;