我正在尝试通过我的Kafka / Zookeeper设置全面设置SSL身份验证。即,代理应使用SSL身份验证与Zookeeper通信,客户端应使用SSL身份验证与代理进行对话。我对此还很陌生,所以做了一个最好的尝试,但是我得到了消息
[2019-03-11 16:17:00,559]错误SASL身份验证使用登录失败 上下文“客户”,例外:{} (org.apache.zookeeper.client.ZooKeeperSaslC留置权) javax.security.sasl.SaslException:使用进行身份验证时出错 Zookeeper法定成员:法定成员的saslToken为null。 在org.apache.zookeeper.client.ZooKeeperSaslClient.createSaslToken(ZooKeeperSaslClient.java:279) 在org.apache.zookeeper.client.ZooKeeperSaslClient.respondToServer(ZooKeeperSaslClient.java:242) 在org.apache.zookeeper.ClientCnxn $ SendThread.readResponse(ClientCnxn.java:805) 在org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:94) 在org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
更新:我想知道我是否使用正确的方法来使用我创建的JAAS文件-当我在Windows中运行时,它与大多数教程所说的包括JVM env变量的方式不同。我正在更新kafka-server-start.bat文件,内容如下:
IF [%1] EQU [] (
echo USAGE: %0 server.properties
EXIT /B 1
)
rem --- THIS IS MY ADDED LINE ---
set KAFKA_OPTS=-Djava.security.auth.login.config=c:/kafka/kafka_2.12-2.1.1/config/kafka_server_jaas.conf
SetLocal
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
)
IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
rem detect OS architecture
wmic os get osarchitecture | find /i "32-bit" >nul 2>&1
IF NOT ERRORLEVEL 1 (
rem 32-bit OS
set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
) ELSE (
rem 64-bit OS
set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
)
)
"%~dp0kafka-run-class.bat" kafka.Kafka %*
EndLocal
这是从Windows挂钩JAAS文件的正确方法吗?
我的各种文件
zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=c:/kafka/zookeeper-3.4.13/data
clientPort=2181
authProvider.1=org.apache.zookeeper.server.auth.DigestAuthenticationProvider
jaasLoginRenew=3600000
requireClientAuthScheme=sasl
zookeeper_jaas.conf
Server {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="admin"
password="admin-secret"
user_admin="admin-secret";
};
代理上的server.properties
listeners=SSL://:9093,SASL_SSL://:9094
security.inter.broker.protocol=SSL
ssl.client.auth=required
ssl.truststore.location=c:/kafka/kafka_2.12-2.1.1/kafka.server.truststore.jks
ssl.truststore.password=Kafkaflow1
ssl.keystore.location=c:/kafka/kafka_2.12-2.1.1/kafka.server.keystore.jks
ssl.keystore.password=Kafkaflow1
ssl.key.password=Kafkaflow1
sasl.enabled.mechanisms=PLAIN
zookeeper.set.acl=true
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
super.users=User:kafkabroker
kafka_server_jaas.conf
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="kafkabroker"
password="kafkabroker-secret"
user_kafkabroker="kafkabroker-secret"
user_client1="client1-secret";
};
Client {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="kafka"
password="kafka-secret";
};
任何具有kafka / Zookeeper身份验证经验的人都可以提出我配置错误的信息吗?