kafka-fips:bcfips不支持升级到java11

klsxnrf1  于 2021-06-05  发布在  Kafka
关注(0)|答案(1)|浏览(383)

我有一个kafka集群在fips模式下运行,配置如下。

Brokers: 3, Zookeeper Nodes: 3
Kafka: 2.0.0, Scala: 2.12
Zookeeper: 3.4.14
Java - 8
bc-fips - 1.0.1

此群集运行正常并且处于健康状态。
目前我们已经升级了kafka(2.4.0)和java(11)版本,之后fips集群无法加载bc fips库并启动kafka。新群集配置:

Brokers: 3, Zookeeper Nodes: 3
Kafka: 2.4.0, Scala: 2.12
Zookeeper: 3.4.14
Java - 11
bc-fips - 1.0.2

根据目前的分析,问题似乎是用新的java版本(11)加载bc fips jar,正如java文档所说:
jdk9以后,通过jre/lib/ext添加外部jar的支持被删除。
在加载时向安全提供程序传递额外参数的功能被删除
因此,当我启动kafka服务时,它会失败,并出现以下错误:

org.apache.kafka.common.KafkaException: org.apache.kafka.common.KafkaException: java.security.NoSuchAlgorithmException: DEFAULT SecureRandom not available
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:158)
    at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:146)
    at org.apache.kafka.common.network.ChannelBuilders.serverChannelBuilder(ChannelBuilders.java:85)
    at kafka.network.Processor.<init>(SocketServer.scala:753)
    at kafka.network.SocketServer.newProcessor(SocketServer.scala:394)
    at kafka.network.SocketServer.$anonfun$addDataPlaneProcessors$1(SocketServer.scala:279)
    at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:158)
    at kafka.network.SocketServer.addDataPlaneProcessors(SocketServer.scala:278)
    at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1(SocketServer.scala:241)
    at kafka.network.SocketServer.$anonfun$createDataPlaneAcceptorsAndProcessors$1$adapted(SocketServer.scala:238)
    at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
    at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
    at kafka.network.SocketServer.createDataPlaneAcceptorsAndProcessors(SocketServer.scala:238)
    at kafka.network.SocketServer.startup(SocketServer.scala:121)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:263)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
    at kafka.Kafka$.main(Kafka.scala:84)
    at kafka.Kafka.main(Kafka.scala)
Caused by: org.apache.kafka.common.KafkaException: java.security.NoSuchAlgorithmException: DEFAULT SecureRandom not available
    at org.apache.kafka.common.security.ssl.SslEngineBuilder.createSecureRandom(SslEngineBuilder.java:126)
    at org.apache.kafka.common.security.ssl.SslEngineBuilder.<init>(SslEngineBuilder.java:86)
    at org.apache.kafka.common.security.ssl.SslFactory.configure(SslFactory.java:95)
    at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:154)
    ... 18 more
Caused by: java.security.NoSuchAlgorithmException: DEFAULT SecureRandom not available
    at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
    at java.base/java.security.SecureRandom.getInstance(SecureRandom.java:364)
    at org.apache.kafka.common.security.ssl.SslEngineBuilder.createSecureRandom(SslEngineBuilder.java:124)
    ... 21 more
[2020-05-18 11:59:39,646] INFO [KafkaServer id=48] shutting down (kafka.server.KafkaServer)

注:如上所述,相同的配置适用于java-8。
任何帮助都将不胜感激。

8ftvxx2r

8ftvxx2r1#

好的,我用下面的设置工作
java:11.0.7版
bcfips:bc-fips-1.0.2.jar
在kafka lib目录中添加bcfips jar:<-kafka root directory->/libs/bc-fips-1.0.2.jar
启动kafka服务器,加载bcfips jar。

相关问题