title: Kafka "Login module not specified in JAAS config"
body: <p>I have a problem communicating with Kafka secured with <code>sasl</code> using console scripts. Kafka is secured with <code>sasl</code>, listener is <code>SASL_PLAINTEXT</code> and mechanism is <code>PLAIN</code>.</p>
  
  <p>What I did:
  I tried listing some data using one of kafka scripts:</p>
  
  <pre><code>bin/kafka-consumer-groups.sh --bootstrap-server (address) --list
  </code></pre>
  
  <p>However I get </p>
  
  <pre><code>WARN Bootstrap broker (address) disconnected (org.apache.kafka.clients.NetworkClient)
  </code></pre>
  
  <p>and command fails, which is understandable because it's secured with sasl.</p>
  
  <p>So I tried how to add client username/password to that command.
  First, I tried to run <code>kafka-console-consumer</code> script, I used <code>--command-config</code> to add necessary file. I quickly discovered that I can't add <code>jaas</code> file directly and I needed to use <code>.properties</code> file, so I did.</p>
  
  <p>My properties file(keep in mind that brackets indicate "censored" data, I can't put all real data here):</p>
  
  <pre><code>bootstrap.servers=(address)
  zookeeper.connect=127.0.0.1:2181
  zookeeper.connection.timeout.ms=6000
  sasl.jaas.config=(path)/consumer_jaas.conf
  security.protocol=SASL_PLAINTEXT
  sasl.mechanism=PLAIN
  group.id=(group)
  </code></pre>
  
  <p>My jaas file:</p>
  
  <pre><code>KafkaClient {
      org.apache.kafka.common.security.plain.PlainLoginModule required
      username=(username)
      password=(password);
  };
  </code></pre>
  
  <p>This <code>jaas</code> file works in my standard java applications.</p>
  
  <p>However, when I'm trying to run either <code>kafka-consumer-groups</code> script or <code>kafka-console-consumer</code>, I get this error:</p>
  
  <pre><code>Exception in thread "main" org.apache.kafka.common.KafkaException: java.lang.IllegalArgumentException: Login module not specified in JAAS config
  at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:94)
  at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:93)
  at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:51)
  at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:84)
  at kafka.admin.AdminClient$.create(AdminClient.scala:229)
  at kafka.admin.AdminClient$.create(AdminClient.scala:223)
  at kafka.admin.AdminClient$.create(AdminClient.scala:221)
  at kafka.admin.ConsumerGroupCommand$KafkaConsumerGroupService.createAdminClient(ConsumerGroupCommand.scala:454)
  at kafka.admin.ConsumerGroupCommand$KafkaConsumerGroupService.&lt;init&gt;(ConsumerGroupCommand.scala:389)
  at kafka.admin.ConsumerGroupCommand$.main(ConsumerGroupCommand.scala:65)
  at kafka.admin.ConsumerGroupCommand.main(ConsumerGroupCommand.scala)
  Caused by: java.lang.IllegalArgumentException: Login module not specified in JAAS config
  at org.apache.kafka.common.security.JaasConfig.&lt;init&gt;(JaasConfig.java:68)
  at org.apache.kafka.common.security.JaasUtils.jaasConfig(JaasUtils.java:59)
  at org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:85)
  </code></pre>
  
  <p>This <code>jaas</code> file is a direct copy of a file that I'm using in java app that communicates with kafka and it works, however here, using console tools, it just doesn't work. I tried searching for a solution but I can't find anything useful. </p>
  
  <p>Can anyone help me with this?</p>