【问题标题】:Kafka Kerberos - Broker onlyKafka Kerberos - 仅限代理
【发布时间】:2019-07-02 04:13:18
【问题描述】:

我正在尝试仅为代理间 kerberos 配置 Kafka 代理。但是,由于它似乎也想通过 Kerberos 连接到 Zookeepers,我似乎不断遇到错误。目前我还没有设置任何 Zookeeper 密钥表。

我的 Kafka 代理 JAAS 配置如下:

    KafkaServer {


    com.sun.security.auth.module.Krb5LoginModule required
    serviceName=kafkabroker
    keytab="/etc/security/keytabs/kafka_server.keytab"
    useKeyTab=true
    storeKey=true
    principal="kafkabroker/kafkabroker0.domain.name@REALM.COM";


    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="user"
    password="secret"
    user_admin="admin"
    user_alice="secret";
};

Client {
    org.apache.kafka.common.security.plain.PlainLoginModule required
    username="admin"
    password="secret";
};

server.properties

sasl.mechanism.inter.broker.protocol=GSSAPI
sasl.enabled.mechanisms=PLAIN, GSSAPI
security.inter.broker.protocol=SASL_SSL
sasl.kerberos.service.name=kafkabroker

上述配置的错误如下:

    [2019-02-08 10:08:17,995] ERROR SASL authentication failed using login context 'Client' with exception: {} (org.apache.zookeeper.client.ZooKeeperSaslClient)
javax.security.sasl.SaslException: Error in authenticating with a Zookeeper Quorum member: the quorum member's saslToken is null.
        at org.apache.zookeeper.client.ZooKeeperSaslClient.createSaslToken(ZooKeeperSaslClient.java:279)
        at org.apache.zookeeper.client.ZooKeeperSaslClient.respondToServer(ZooKeeperSaslClient.java:242)
        at org.apache.zookeeper.ClientCnxn$SendThread.readResponse(ClientCnxn.java:805)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:94)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1145)
[2019-02-08 10:08:18,015] ERROR [ZooKeeperClient] Auth failed. (kafka.zookeeper.ZooKeeperClient)
[2019-02-08 10:08:18,048] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.apache.zookeeper.KeeperException$AuthFailedException: KeeperErrorCode = AuthFailed for /consumers
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:126)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
        at kafka.zookeeper.AsyncResponse.maybeThrow(ZooKeeperClient.scala:499)
        at kafka.zk.KafkaZkClient.createRecursive(KafkaZkClient.scala:1456)
        at kafka.zk.KafkaZkClient.makeSurePersistentPathExists(KafkaZkClient.scala:1378)
        at kafka.zk.KafkaZkClient$$anonfun$createTopLevelPaths$1.apply(KafkaZkClient.scala:1370)
        at kafka.zk.KafkaZkClient$$anonfun$createTopLevelPaths$1.apply(KafkaZkClient.scala:1370)
        at scala.collection.immutable.List.foreach(List.scala:392)
        at kafka.zk.KafkaZkClient.createTopLevelPaths(KafkaZkClient.scala:1370)
        at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:373)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:202)
        at io.confluent.support.metrics.SupportedServerStartable.startup(SupportedServerStartable.java:114)
        at io.confluent.support.metrics.SupportedKafka.main(SupportedKafka.java:66)
[2019-02-08 10:08:18,056] INFO shutting down (kafka.server.KafkaServer)
[2019-02-08 10:08:18,058] WARN  (kafka.utils.CoreUtils$)
java.lang.NullPointerException
        at kafka.server.KafkaServer$$anonfun$shutdown$5.apply$mcV$sp(KafkaServer.scala:579)
        at kafka.utils.CoreUtils$.swallow(CoreUtils.scala:86)
        at kafka.server.KafkaServer.shutdown(KafkaServer.scala:579)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:329)
        at io.confluent.support.metrics.SupportedServerStartable.startup(SupportedServerStartable.java:114)
        at io.confluent.support.metrics.SupportedKafka.main(SupportedKafka.java:66)
[2019-02-08 10:08:18,060] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2019-02-08 10:08:18,063] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2019-02-08 10:08:18,065] INFO shut down completed (kafka.server.KafkaServer)
[2019-02-08 10:08:18,065] INFO Shutting down SupportedServerStartable (io.confluent.support.metrics.SupportedServerStartable)
[2019-02-08 10:08:18,065] INFO Shutting down KafkaServer (io.confluent.support.metrics.SupportedServerStartable)
[2019-02-08 10:08:18,065] INFO shutting down (kafka.server.KafkaServer)

换句话说,我只希望 kerberos 用于 broker-to-broker,而 PLAIN SASL_SSL 用于 Broker - Zookeeper。这可能吗?

【问题讨论】:

  • 首先,您还需要 Zookeeper kerberized - docs.confluent.io/current/kafka/authentication_sasl/…
  • 好的,所以我设法让它工作。我将 server.properties 更改为: sasl.enabled.mechanisms=GSSAPI 而在 server_jaas.conf 中,我只有带有 krb5LoginModule 子块的 KafkaServer 块。

标签: apache-kafka apache-zookeeper kerberos


【解决方案1】:

所以,我设法让这个工作。我需要使用“default_realm”和“[realms]”详细信息更新我的 /etc/krb5.conf 文件。

然后我将server_jaas.conf文件改成如下:

KafkaServer {
    com.sun.security.auth.module.Krb5LoginModule required
    serviceName=kafkabroker
    keytab="/etc/security/keytabs/kafka_server.keytab"
    useKeyTab=true
    storeKey=true
    principal="kaffka_service_account@REALM";
}

最后我更新了我的 server.properties 文件如下:

sasl.mechanism.inter.broker.protocol=GSSAPI
sasl.enabled.mechanisms=GSSAPI
security.inter.broker.protocol=SASL_SSL
sasl.kerberos.service.name=kafkabroker

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-09
    • 2019-07-14
    • 2019-03-08
    • 2017-07-22
    • 1970-01-01
    • 2018-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多