У меня есть установка kafka (с ssl listener и ssl-аутентификацией клиента). Он работает нормально, пока я не попробую добавить ACL. это ошибка (полная ошибка внизу):
[edit-1] первая ошибка при запуске kafka следующая:
[2018-07-25 14:15:10,498] ERROR Exception while trying to create SASL client: java.lang.ArrayIndexOutOfBoundsException: 0 (org.apache.zookeeper.client.ZooKeeperSaslClient)
ниже представлена конфигурация и дополнительная информация из журналов:
[2018-07-25 12:22:27,156] ERROR SASL authentication with Zookeeper Quorum member failed: javax.security.sasl.SaslException: saslClient failed to initialize properly: it's null. (org.apache.zookeeper.ClientCnxn)
В kafka / conf / server.properties я добавил следующее:
listeners=SASL_PLAINTEXT://:9092,SSL://:9093
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
ssl.keystore.location=/some-path/server.keystore.jks
ssl.keystore.password=password
ssl.key.password=password
ssl.truststore.location=/some-path/server.truststore.jks
ssl.truststore.password=password
ssl.client.auth=required
# without the next 2 lines kafka works fine but with no ACL
authorizer.class.name=kafka.security.auth.SimpleAclAuthorizer
super.users=User:CN=bob,OU=bob,O=bob,L=bob,ST=bob,C=il
allow.everyone.if.no.acl.found=false
sasl.enabled.mechanisms=PLAIN
zookeeper / conf / zoo.cfg:
authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
#requireClientAuthScheme=sasl
quorum.auth.enableSasl=true
quorum.auth.learnerRequireSasl=true
quorum.auth.serverRequireSasl=true
#quorum.auth.learner.loginContext=QuorumLearner
#quorum.auth.server.loginContext=QuorumServer
#quorum.auth.kerberos.servicePrincipal=servicename/_HOST
quorum.cnxn.threads.size=20
Также есть файлы jaas kafka jaas:
KafkaServer {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="kafkabroker"
password="kafkabroker-secret";
};
Client {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="admin"
password="admin";
};
смотритель зоопарка Яас:
Server {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="admin"
password="admin";
};
полная ошибка из журнала kafka при запуске:
[2018-07-25 12:22:27,120] ERROR Exception while trying to create SASL client: java.lang.ArrayIndexOutOfBoundsException: 0 (org.apache.zookeeper.client.ZooKeeperSaslClient)
[2018-07-25 12:22:27,121] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will attempt to SASL-authenticate using Login Context section 'Client' (org.apache.zookeeper.ClientCnxn)
[2018-07-25 12:22:27,132] INFO Socket connection established to localhost/127.0.0.1:2181, initiating session (org.apache.zookeeper.ClientCnxn)
[2018-07-25 12:22:27,154] INFO Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x100007b700f0003, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)
[2018-07-25 12:22:27,156] ERROR SASL authentication with Zookeeper Quorum member failed: javax.security.sasl.SaslException: saslClient failed to initialize properly: it's null. (org.apache.zookeeper.ClientCnxn)
[2018-07-25 12:22:27,161] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientAuthFailedException: Auth failed either before or while waiting for connection
at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:231)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:250)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:221)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:95)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1548)
at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:348)
at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:372)
at kafka.server.KafkaServer.startup(KafkaServer.scala:202)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:75)
at kafka.Kafka.main(Kafka.scala)
[2018-07-25 12:22:27,163] INFO shutting down (kafka.server.KafkaServer)
[2018-07-25 12:22:27,165] WARN (kafka.utils.CoreUtils$)
java.lang.NullPointerException
at kafka.server.KafkaServer.$anonfun$shutdown$6(KafkaServer.scala:572)
at kafka.utils.CoreUtils$.swallow(CoreUtils.scala:85)
at kafka.server.KafkaServer.shutdown(KafkaServer.scala:572)
at kafka.server.KafkaServer.startup(KafkaServer.scala:329)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:75)
at kafka.Kafka.main(Kafka.scala)
[2018-07-25 12:22:27,173] INFO shut down completed (kafka.server.KafkaServer)
[2018-07-25 12:22:27,174] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2018-07-25 12:22:27,177] INFO shutting down (kafka.server.KafkaServer)
Формат файла jaas мне не совсем понятен, в любом случае, что в конечном итоге сработало для меня, так это использовать все форматы пользователя / пароля как для файлов jaas клиента, так и сервера
Клиент {org.apache.zookeeper.server.auth.DigestLoginModule required username = "admin" password = "admin-pass" user_admin = "admin"; };