a0x8o / kafka

A high-throughput, distributed, publish-subscribe messaging system
Apache License 2.0
67 stars 171 forks source link

Externally renewed ticket is not getting reloaded and renewTgt not working as expected #10

Open javatype opened 3 years ago

javatype commented 3 years ago

Hi,

I am using kafka appender library to push logs to logstash. I am using kerberos authentication method to connect to kafka broker. At the start of my app, everything works fine and I am able to connect to kafka brokers. Below are few producer configs I am providing.

 <producerConfig>sasl.jaas.config=com.sun.security.auth.module.krb5LoginModule
required
ticketCache="path-to-my-ticket-cache"
useTicketCache="true"
refreshKrb5Config="true"
doNotPrompt="true"
principal="myprincipal@realm";
</producerConfig>

When I hit this command -klist -c path-to-my-ticket-cache , I see ticket is getting renewed after every 2 hours but the same renewed time is not reflecting in my java app. The app still shows the initial expiry time loaded at startup and it destroys the ticket after expiry and authentication starts failing.

Few Things I tried,

Added renewTgt=true and sasl.kerberos.kinit.cmd=/usr/bin/kinit -c path-to-my-ticket-cache -R property to producer config, it tried to renew but failed with error-IOException: error=2, No such file or directory. When i hit same command from shell, it works fine and renew ticket. how I can pass cache location parameter in this command? How we can force the app to read the ticket from the main cache which is getting renewed but kafka client seems not aware of it?