nettosphere: SSL WebSocket exception - Received fatal alert: certificate_unknown
Hello ! Many thanks for nettosphere and its support !
I’m trying to get a self signed certificate with ssl to nettosphere working. I checked in the unit tests of nettosphere for something appropriate and ended up with this :
SelfSignedCertificate ssc = new SelfSignedCertificate();
SslContext sslServer = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build();
configBuilder.sslContext(sslServer);// .sslContext(sslCtx);
configBuilder.enabledCipherSuites(sslServer.cipherSuites().toArray(new String[]{}));
configBuilder.maxWebSocketFrameAggregatorContentLength(maxMsgSize);
configBuilder.initParam("org.atmosphere.cpr.asyncSupport", "org.atmosphere.container.NettyCometSupport");
configBuilder.initParam(ApplicationConfig.SCAN_CLASSPATH, "false");
configBuilder.initParam(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true").port(port).host(address); // all
configBuilder.maxChunkContentLength(maxMsgSize);
configBuilder.maxWebSocketFrameSize(maxMsgSize);
nettosphere = new Nettosphere.Builder().config(configBuilder.build()).build();
nettosphere.start();
The results are mixed. This exception is constantly being thrown
ERROR o.a.n.BridgeRuntime [BridgeRuntime.java:784] Unexpected and unhandled I/O Exception
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:477) ~[netty-all-4.1.66.Final.jar:4.1.66.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-all-4.1.66.Final.jar:4.1.66.Final]
Strangely it does not appear to affect the resource handlers I have written, however it does kill the org.atmosphere.nettosphere.HttpStaticFileServerHandler
09:52:15.366 [nioEventLoopGroup-3-1] DEBUG i.n.c.AbstractChannelHandlerContext [AbstractChannelHandlerContext.java:305] An exception java.lang.NullPointerException
at org.atmosphere.nettosphere.HttpStaticFileServerHandler.exceptionCaught(HttpStaticFileServerHandler.java:285)
at org.atmosphere.nettosphere.BridgeRuntime.exceptionCaught(BridgeRuntime.java:785)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:281)
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:273)
at io.netty.handler.ssl.SslHandler.exceptionCaught(SslHandler.java:1106)
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:302)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:381)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
So in the end the browser won’t load the site.
Any ideas, examples, or suggestions on how to remove this exception, but still have a “valid” self signed certificate ? Thanks !
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 49 (49 by maintainers)
Commits related to this issue
- Rollback Fixes for #153 — committed to Atmosphere/nettosphere by jfarcand 5 years ago
- WIP #153 — committed to Atmosphere/nettosphere by jfarcand 5 years ago
- Fixes #153 — committed to Atmosphere/nettosphere by jfarcand 5 years ago
@supertick I’ve released 3.2.6!
@thabach THANKS!!! I always like to work with you! Looking at it today! Thanks @supertick
@jfarcand I digged a bit too, not sure why the
HttpStaticFileServerHandlerin the presence of SSL chooses to send the file chunk-encoded, maybe a hint:Cheers.
Easy 😃
https://github.com/MyRobotLab/nettosphere-ssl I tried to provide the simplest example…
ssl = false returns the index.html correctly ssl = true does not
@supertick If you can share a github’s repo with a test case I will take a look
interestingly, my custom resource works fine in https
configBuilder.resource("/api", this);but any static file with the default file path resource - does not work e.g. index.html inside this path
configBuilder.resource("./src/main/resources/resource/WebGui/app");Thanks for the suggestion …