0

I am generating a Kerberos token using Python

def generate_kerberos_token(self):
    kinit = '/usr/bin/kinit'
    kinit_args = [ kinit, '%s@%s' % (self.username, self.realm) ]
    kinit = Popen(kinit_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
    kinit.stdin.write('{}\n'.format(self.password).encode("utf-8"))
    kinit.stdin.flush()
    kinit.wait()

My app has stopped working after 5 days. I checked the knit.config file. It mentioned:

renew_lifetime = 5d

I want to regenerate the token after five. as my data is not get updated due to authentication is not happening after 5 days.

How to re-new token in-order to authentication process?

James Z
  • 12,209
  • 10
  • 24
  • 44
Vijay Sharma
  • 51
  • 1
  • 7
  • Use a `cron` job. Even better, use two: one to renew the ticket with `kinit -R` every few hours (below ticket lifetime) and one to re-create the ticket **with a keytab file, not a simulacrum of interactive password entry** every few days (below ticket renewal lifetime). – Samson Scharfrichter Feb 09 '21 at 23:53
  • https://stackoverflow.com/questions/39221465/login-script-to-use-machine-password-for-kinit-to-obtain-ticket-at-login – Samson Scharfrichter Feb 09 '21 at 23:54
  • https://stackoverflow.com/questions/43189044/hadoop-kerberos-ticket-auto-renew – Samson Scharfrichter Feb 09 '21 at 23:54

0 Answers0