Ssl Zookeeper TLS错误:与会话0x0握手失败(org.apache.Zookeeper.server.NettyServerCnxnFactory)

Ssl Zookeeper TLS错误:与会话0x0握手失败(org.apache.Zookeeper.server.NettyServerCnxnFactory),ssl,apache-zookeeper,tls1.2,Ssl,Apache Zookeeper,Tls1.2,不能用TSL启动Zookeeper,请帮帮我 Zookeeper版本:3.5.8-f439ca583e70862c3068a1f2a7d4d068eec33315,于2020年4月5日15:53 GMT建成 zookeeper.properties: ###################[ MAIN ]################### dataDir=~/zookeeper_ssl/data/zookeeper-data clientPort=2185 secureCli

不能用TSL启动Zookeeper,请帮帮我

Zookeeper版本:3.5.8-f439ca583e70862c3068a1f2a7d4d068eec33315,于2020年4月5日15:53 GMT建成

zookeeper.properties:

###################[ MAIN ]###################
dataDir=~/zookeeper_ssl/data/zookeeper-data    
clientPort=2185    
secureClientPort=2186    
maxClientCnxns=0     

##############[ AUTHENTICATION ]##############

authProvider.sasl=org.apache.zookeeper.server.auth.SASLAuthenticationProvider # (tried change to authProvider.1 but no success)    
jaasLoginRenew=3600000    
requireClientAuthScheme=sasl    

#############[ SSL ]############    authProvider.x509=org.apache.zookeeper.server.auth.X509AuthenticationProvider # (tried to remove - but no success)    
serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory    
ssl.keyStore.location=~/zookeeper_ssl/ssl/broker1.jks    
ssl.keyStore.password=xxx    
ssl.trustStore.location=~/zookeeper_ssl/ssl/broker1.jks    
ssl.trustStore.password=xxx    
clientAuth=none     
tickTime=3000    
initLimit=10    
syncLimit=5

##############[ OTHER CONFIGS ]#############    
4lw.commands.whitelist=*    
admin.enableServer=true    
admin.serverPort=8181
这是一个良好的开端。然后尝试连接:

./bin/kafka-run-class \
> -Dzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty \
> -Dzookeeper.ssl.client.enable=true \
> -Dzookeeper.ssl.keyStore.location=~/zookeeper_ssl/ssl/dev1.jks \
> -Dzookeeper.ssl.keyStore.password=xxx \
> -Dzookeeper.ssl.trustStore.location=~/zookeeper_ssl/ssl/dev1.jks \
> -Dzookeeper.ssl.trustStore.password=xxx \
> org.apache.zookeeper.ZooKeeperMain -server localhost:2186
我们有:

连接到本地主机:2186
欢迎来到动物园管理员
JLine支持已禁用
实际上这里什么也没发生-所以按下CTRL+C ^C

zookeeper.log:

[2020-08-17 18:02:07,667] DEBUG Using Java8 optimized cipher suites for Java version 1.8 (org.apache.zookeeper.common.X509Util)

[2020-08-17 18:02:07,981] DEBUG Default protocols (JDK): [TLSv1.2, TLSv1.1, TLSv1]  (io.netty.handler.ssl.JdkSslContext)

[2020-08-17 18:02:07,981] DEBUG Default cipher suites (JDK): [TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA] (io.netty.handler.ssl.JdkSslContext)

[2020-08-17 18:02:08,104] DEBUG SSL handler added for channel: [id: 0x6bcbf86b, L:/x.x.x.x:2186 - R:/x.x.x.x:56620] (org.apache.zookeeper.server.NettyServerCnxnFactory)

[2020-08-17 18:02:08,123] DEBUG -Dio.netty.recycler.maxCapacityPerThread: 4096 (io.netty.util.Recycler)

[2020-08-17 18:02:08,123] DEBUG -Dio.netty.recycler.maxSharedCapacityFactor: 2 (io.netty.util.Recycler)

[2020-08-17 18:02:08,123] DEBUG -Dio.netty.recycler.linkCapacity: 16 (io.netty.util.Recycler)

[2020-08-17 18:02:08,123] DEBUG -Dio.netty.recycler.ratio: 8 (io.netty.util.Recycler)

[2020-08-17 18:02:08,133] DEBUG -Dio.netty.buffer.checkAccessible: true (io.netty.buffer.AbstractByteBuf)

[2020-08-17 18:02:08,133] DEBUG -Dio.netty.buffer.checkBounds: true (io.netty.buffer.AbstractByteBuf)

[2020-08-17 18:02:08,134] DEBUG Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@3021f880 (io.netty.util.ResourceLeakDetectorFactory)

[2020-08-17 18:02:08,149] ERROR Unsuccessful handshake with session 0x0 (org.apache.zookeeper.server.NettyServerCnxnFactory)

[2020-08-17 18:02:08,149] DEBUG close called for sessionid:0x0 (org.apache.zookeeper.server.NettyServerCnxn)

[2020-08-17 18:02:08,149] DEBUG cnxns size:0 (org.apache.zookeeper.server.NettyServerCnxn)

[2020-08-17 18:02:08,153] WARN Exception caught (org.apache.zookeeper.server.NettyServerCnxnFactory)

io.netty.handler.codec.DecoderException: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 0000002d000000000000000000000000000075300000000000000000000000100000000000000000000000000000000000

        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)

        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)

        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)

        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:163)

        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)

        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)

        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)

        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)

        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)

        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)

        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

        at java.lang.Thread.run(Thread.java:745)

Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 0000002d000000000000000000000000000075300000000000000000000000100000000000000000000000000000000000

        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1214)

        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1282)

        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)

        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)

        ... 17 more

[2020-08-17 18:02:08,153] DEBUG Closing  /x.x.x.x:56620[0](queued=0,recved=0,sent=0) (org.apache.zookeeper.server.NettyServerCnxnFactory)

[2020-08-17 18:02:08,153] DEBUG close called for sessionid:0x0 (org.apache.zookeeper.server.NettyServerCnxn)

[2020-08-17 18:02:08,153] DEBUG cnxns size:0 (org.apache.zookeeper.server.NettyServerCnxn)
jks内部

密钥库代理1.jks

密钥库dev1.jks


已发现问题-正确的参数为:

-Dzookeeper.client.secure=true


(Dzookeeper.ssl.client.enable=true是错误的)

您试图连接的机器是否启用了ssl?@rootkonda,是的。具有此jls的TLS在相同的服务器上运行良好。配置的问题。
Alias name: zserver
Entry type: PrivateKeyEntry
Owner: CN=zserver, C=RU


Alias name: dev1
Entry type: trustedCertEntry
Owner: CN=dev1, C=RU
Alias name: zserver
Entry type: trustedCertEntry
Owner: CN=zserver, C=RU


Alias name: dev1
Entry type: PrivateKeyEntry
Owner: CN=dev1, C=RU