So you mean three sections, namely KafkaServer, KafkaClient and Client
needs to be kept inside a file and passed to broker. And section Server
needs to be passed to zookeeper? I did exactly that, even copied your
config. It still isn't working.

On Wed, Apr 10, 2019 at 7:07 AM 1095193...@qq.com <1095193...@qq.com> wrote:

>
>
> On 2019/04/09 11:21:10, Shantanu Deshmukh <shantanu...@gmail.com> wrote:
> > That was a blooper. But even after correcting, it still isn't working.
> > Still getting the same error.
> > Here are the configs again:
> >
> > *Kafka config: *
> >
> > KafkaServer {
> >    org.apache.kafka.common.security.plain.PlainLoginModule required
> >    username="admin"
> >    password="admin-secret"
> >    user_admin="admin-secret"
> >    user_dip="dip";
> > };
> > KafkaClient {
> >    org.apache.kafka.common.security.plain.PlainLoginModule required
> >    username="dip"
> >    password="dip-secret";
> > };
> >
> > *Zookeeper config:*
> >
> > Server {
> >    org.apache.kafka.common.security.plain.PlainLoginModule required
> >    username="admin"
> >    password="admin-secret"
> >    user_admin="admin-secret";
> > };
> >
> > On Mon, Apr 8, 2019 at 2:11 PM 1095193...@qq.com <1095193...@qq.com>
> wrote:
> >
> > >
> > >
> > > On 2019/04/03 13:08:45, Shantanu Deshmukh <shantanu...@gmail.com>
> wrote:
> > > > Hello everyone,
> > > >
> > > > I am trying to setup Kafka SASL authentication on my single node
> Kafka on
> > > > my local machine. version 2.
> > > >
> > > > Here's my Kafka broker JAAS file:
> > > >
> > > > KafkaServer {
> > > >    org.apache.kafka.common.security.plain.PlainLoginModule required
> > > >    username="admin"
> > > >    password="admin"
> > > >    user_admin="admin"
> > > >    user_dip="dip";
> > > > };
> > > > Client {
> > > >    org.apache.kafka.common.security.plain.PlainLoginModule required
> > > >    username="admin"
> > > >    password="admin-secret";
> > > > };
> > > >
> > > > Zookeeper JAAS file:
> > > >
> > > > Server {
> > > >    org.apache.kafka.common.security.plain.PlainLoginModule required
> > > >    username="admin"
> > > >    password="admin-secret"
> > > >    user_admin="admin-secret";
> > > > };
> > > >
> > > > Kafka broker properties
> > > >
> > > > listeners=SASL_PLAINTEXT://localhost:9092authroizer.class.name
> > > =kafka.security.auth.SimpleAclAuthorizer
> > > > security.inter.broker.protocol=SASL_PLAINTEXT
> > > > sasl.mechanism.inter.broker.protocol=PLAINTEXT
> > > > sasl.enabled.mechanisms=PLAINTEXT
> > > >
> > > > Zookeeper properties:
> > > >
> > > >
> > >
> authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
> > > > requireClientAuthScheme=sasl
> > > > jaasLoginRenew=3600000
> > > >
> > > > When I try to start Kafka server I am continuously getting this
> error.
> > > >
> > > > [2019-04-03 16:32:31,267] DEBUG Accepted connection from
> > > > /127.0.0.1:45794 on /127.0.0.1:9092 and assigned it to processor 1,
> > > > sendBufferSize [actual|requested]: [102400|102400] recvBufferSize
> > > > [actual|requested]: [102400|102400] (kafka.network.Acceptor)
> > > > [2019-04-03 16:32:31,267] DEBUG Processor 1 listening to new
> > > > connection from /127.0.0.1:45794 (kafka.network.Processor)
> > > > [2019-04-03 16:32:31,268] WARN [Controller id=0, targetBrokerId=0]
> > > > Unexpected error from localhost/127.0.0.1; closing connection
> > > > (org.apache.kafka.common.network.Selector)
> > > > java.lang.NullPointerException
> > > >     at
> > >
> org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.sendSaslClientToken(SaslClientAuthenticator.java:266)
> > > >     at
> > >
> org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.authenticate(SaslClientAuthenticator.java:204)
> > > >     at
> > >
> org.apache.kafka.common.network.KafkaChannel.prepare(KafkaChannel.java:141)
> > > >     at
> > >
> org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:532)
> > > >     at
> org.apache.kafka.common.network.Selector.poll(Selector.java:467)
> > > >     at
> > > org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:535)
> > > >     at
> > >
> org.apache.kafka.clients.NetworkClientUtils.awaitReady(NetworkClientUtils.java:74)
> > > >     at
> > >
> kafka.controller.RequestSendThread.brokerReady(ControllerChannelManager.scala:279)
> > > >     at
> > >
> kafka.controller.RequestSendThread.doWork(ControllerChannelManager.scala:233)
> > > >     at
> kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:82)
> > > > [2019-04-03 16:32:31,268] WARN [Controller id=0, targetBrokerId=0]
> > > > Connection to node 0 (localhost/127.0.0.1:9092) terminated during
> > > > authentication. This may indicate that authentication failed due to
> > > > invalid credentials. (org.apache.kafka.clients.NetworkClient)
> > > >
> > > > Please help. Unable to understand this problem.
> > > >
> > > >
> > > > Thanks & Regards,
> > > >
> > > > Shantanu Deshmukh
> > > >
> > > user_admin="admin" in KafkaServer is not consistent with
> > > password="admin-secret" in Client
> > >
> Hi,
>    First, the Client section is  used by zookeeper client and the
> KafkaClient section is used by Kafka client. Then, the username and
> password in Client/KafkaClient section should correspond to the user_*="*"
> in KafkaServer/Server section. For example:
>
> KafkaServer {
>    org.apache.kafka.common.security.plain.PlainLoginModule required
>    username="admin"
>    password="admin-secret"
>    user_admin="admin-secret"
>    user_alice="alice-secret";
> };
> KafkaClient {
>    org.apache.kafka.common.security.plain.PlainLoginModule required
>    //corresponding to user_alice="alice-secret" in KafkaServer
>    username="alice"
>    password="alice-secret";
> };
> Client{
>    org.apache.kafka.common.security.plain.PlainLoginModule required
>    //corresponding to user_bob="bib-secret" in Server
>    username="bob"
>    password="bob-secret";
>
> };
> *Zookeeper config:*
>
> Server {
>    org.apache.kafka.common.security.plain.PlainLoginModule required
>    username="admin"
>    password="admin-secret"
>    user_bob="bob-secret";
> };
>
>
>
>

Reply via email to