Search code examples
pythonapache-kafkarealmkerberos

Set Realm object properties with Python


I want to authenticate a Kafka client using a domain account with keytab of the account. How can I set the realm object properties like kdc and admin server using python?


Solution

  • This information actually sits in the kerberos configuration file called krb5.conf in each server in your cluster - in case of Unix servers, the exact path would be /etc/krb5.conf.

    These attributes cannot be configured at the client side.

    For authenticating your client, you'll just need to:

    1. get the principal and the keytab created
    2. supply these in a jaas.conf file
    3. set the properties appropriately to point to the jaas.conf and krb5.conf

    I've tried to simplify the process here but here is a detailed reference on this subject.

    Hope this helps.