zookeeper sasl身份验证问题

时间:2017-08-01 15:05:31

标签: authentication apache-zookeeper jaas sasl

我正在尝试为我的zookeeper for Kafka设置SASL身份验证。我按照以下链接

中提到的所有步骤进行操作

https://cwiki.apache.org/confluence/display/ZOOKEEPER/Client-Server+mutual+authentication

下面是我的server_jaas.conf文件,保存在/ home目录

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

以下是我的java.env文件配置

SERVER_JVMFLAGS="-Djava.security.auth.login.config=/home/server_jaas.conf"

以下是我得到的错误

2017-08-01 16:49:40,774 [myid:] - ERROR [main:ServerCnxnFactory@199] - No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
2017-08-01 16:49:40,774 [myid:] - ERROR [main:ZooKeeperServerMain@64] - Unexpectked exception, exiting abnormally
java.io.IOException: No JAAS configuration section named 'Server' was foundin '/home/server_jaas.conf'.
    at org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(ServerCnxnFactory.java:200)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:82)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:117)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:87)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:53)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)

2 个答案:

答案 0 :(得分:0)

配置文件的内容可能是这样的:

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

并确保/home/server_jaas.conf的位置正确无误。

我得到了同样的异常,因为我给出了这个配置文件的错误位置。

答案 1 :(得分:-1)

尝试添加;到服务器定义的末尾

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