내 도메인에 인증서 (comodo에서)를 구입했는데 개인 키, 인증서 및 ca 번들 파일의 3 개 파일이 있습니다.netty 서버에 인증서 체인을 추가하려면 어떻게해야합니까?
내 아파치 서버/mod_ssl에 추가하면 완벽하게 작동합니다. SSLCertificateFile, SSLCertificateKeyFile, SSLCertificateChainFile이 3 개의 구성 매개 변수를 가지고 있으므로 쉽게 구성 할 수 있습니다.
네트워킹 라이브러리로 Netty를 사용하여 다른 Java 응용 프로그램에 추가하려고합니다. Config.KEY_FILE_PATH
내 개인 키 파일 경로, Config.CERT_FILE_PATH
와
SslContext sslContext = null;
File cert = new File(Config.CERT_FILE_PATH);
File key = new File(Config.KEY_FILE_PATH);
sslContext = SslContextBuilder.forServer(cert, key).build();
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.localAddress(port)
.childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childHandler(new WebServerInitializer(sslCtx));
Channel ch = b.bind().sync().channel();
내 인증서 파일 경로 : 다음 내 서버 코드입니다.
하지만 문제는 일부 브라우저에서 인증서 오류라고 말합니다 (자세한 내용은 mac os의 Chrome이며 브라우저는 내 인증서를 신뢰하지 않습니다).
몇 가지 조사를 수행했는데 내 netty http 서버가 클라이언트에 전체 인증서 체인을 보내지 않았으며 (내 인증서의 중급 인증서 포함), 인증서 만 전송합니다 (KeyStore Explorer 도구로 검사).
Config.CERT_FILE_PATH
값을 ca-bundle 파일의 경로로 바꾸거나 인증서 파일의 값을 ca-bundle 파일에 추가하고 새 파일을 사용하지만 여전히 운이 좋지는 않습니다. 예외가 던졌습니다.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLException: Received fatal alert: decrypt_error
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:358)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLException: Received fatal alert: decrypt_error
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1646)
at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1614)
at sun.security.ssl.SSLEngineImpl.recvAlert(SSLEngineImpl.java:1780)
at sun.security.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:1075)
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:901)
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:775)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1135)
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1025)
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:965)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:327)
... 12 more
ca-bundle을 사용하여 인증서를 올바르게 netty 서버에 추가 할 수 있습니까?
다른 브라우저 (Mac의 크롬 기본 브라우저를 제외한 Windows 및 Mac의 모든 브라우저)가 여전히 내 오류 서버와 함께 작동하는 이유는 무엇입니까?
이 인증서를 잘못된 순서로 연결합니다. 적절한 순서는 인증서 체인 전의 내 인증서 서버입니다. – Viet