quarkusio / quarkus-http

Apache License 2.0
31 stars 31 forks source link

SNI Support in Quarkus's Undertow websocket #23

Open gorshkov-leonid opened 4 years ago

gorshkov-leonid commented 4 years ago

Hello, I am not a specialist in this question, but It seemed I have a problem because Quarkus does not support SNI extension in SSL. Although I tested it with HTTP rest-client and there were no problems.

Details: *I have a the same problem, the same message and the same difference between rest's logs and websocket's logs:

I decided to find where this extension is set in vertex (because HTTP rest-client works):

But in websockets-jsr I can't see any mentions of SNI and SSLEngine is created without host and port:

But I decided to check how things are going here: https://github.com/undertow-io/undertow/ And found that they suggest some SNISSLContextSpi

Could you help with an answer if it is a bug, or not?

stuartwdouglas commented 4 years ago

I think this should fix it: https://github.com/quarkusio/quarkus-http/commit/b2ea4ebf56a7e9599087d138ae36700b9c9dc9e7

I will try and get this into the next 1.4 release.

Stuart

On Tue, 28 Apr 2020 at 07:11, Leonid Gorshkov notifications@github.com wrote:

Hello, I am not a specialist in this question, but It seemed I have a problem because Quarkus does not support SNI extension in SSL. Although I tested it with HTTP rest client and there were no problems.

Details: I have a problem, stack trace and so one as here: https://stackoverflow.com/questions/2804551/tls-with-sni-in-java-clients So, as I found out that it is related on changes in java https://stackoverflow.com/questions/30817934/extended-server-name-sni-extension-not-sent-with-jdk1-8-0-but-send-with-jdk1-7

I decided to find where this extension is set in vertx:

- https://github.com/eclipse-vertx/vert.x/blob/3.8.5/src/main/java/io/vertx/core/http/impl/HttpServerChannelInitializer.java#L102

But in websockets-jsr I can't see any mentions of SNI and SSLEngine is create without host and port:

- https://github.com/quarkusio/quarkus-http/blob/3.0.4.Final/websockets-jsr/src/main/java/io/undertow/websockets/jsr/WebsocketConnectionBuilder.java#L189

But I decided to check how things are going here: https://github.com/undertow-io/undertow/ And found that they suggest some SNISSLContextSpi

Could you help with an answer if it is a bug, or not?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/quarkusio/quarkus-http/issues/23, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACQG67PJ3Z5JXYK54HP6NLROXYHBANCNFSM4MSISFWA .

gorshkov-leonid commented 4 years ago

@stuartwdouglas , thank you. I checked the fix via java hot swap. Although a test failed It is working in my case. About releases how long does it take usually to prepare release? And while it is preparing, maybe you know any WA. I tried solution from this, but it is not working:

        URI uri = URI.create(webSocketUrl);
        SSLParameters sslParameters = new SSLParameters();
        sslParameters.setServerNames(singletonList(new SNIHostName(uri.getHost())));
        HttpsURLConnection.setDefaultSSLSocketFactory(
                new SSLSocketFactoryWrapper(
                        WebSocketClientSslProviderImpl.getSystemSslContext().getSocketFactory(),
                        sslParameters
                )
        );

Apparently factory is not used... Are you aware of something about it?

stuartwdouglas commented 4 years ago

We don't use HttpsURLConnection

gorshkov-leonid commented 4 years ago

@stuartwdouglas , sorry for the bother. As I understand you do not know a workaround, are you? And when the next release is planned?