0

We have a keborosed cloudera cluster setup for apache kafka, I am trying to connect it using python and I have installed the MIT kerborose for windos system

Main code:

import os
from kafka import KafkaConsumer
import logging

os.environ['KAFKA_OPTS'] = '-Djava.security.auth.login.config=path/local_kafka_client_jaas.conf'
os.environ['KAFKA_OPTS'] = '-Djava.security.krb5.conf=path/krb5.conf'

logging.basicConfig(filename='example.log',level=logging.DEBUG)

consumer = KafkaConsumer('topic',bootstrap_servers="server",
                         group_id="count",
                         security_protocol="SASL_PLAINTEXT",
                         sasl_mechanism="GSSAPI",
                         api_version=(0,11,5),
                         ssl_keyfile='path to keyfile/file.keytab'
                         )

local_kafka_client_jaas.conf

KafkaClient {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  principal="principal"
  keyTab="path/file.keytab"
  client=true
  renewTicket=true
  storeKey=true
  serviceName="kafka";
};
Client {
  com.sun.security.auth.module.Krb5LoginModule required
  useKeyTab=true
  client=true
  principal="principal"
  keyTab="path/file.keytab"
  renewTicket=true
  storeKey=true
  serviceName="zookeeper";
};

I am using above code to connect however when ran, it is opening the MIT kerboros app window and asking for principal and password, however I want it to use keytab file in location.

Any help would be appreciated.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Vishal Kamlapure
  • 590
  • 4
  • 16

0 Answers0