I have the below code snippet for kerberos login using keytab.
Configuration conf = HBaseConfiguration.create();
conf.addResource("hbase-site.xml");
Connection connection = ConnectionFactory.createConnection(conf);
UserGroupInformation.setConfiguration(conf);
UserGroupInformation.loginUserFromKeytabAndReturnUGI(user, keytabpath);
We also have the renew lifetime set to 7days in our environment per security standards. Hence, the above code works for 7days and on the last day although the application code tries to renew toek, it fails for 'renew until' constraints. I have to manually do a kinit to keep things working for next 7days.
Is there an alternative to handle this at the application code level? I am exploring options at the environment level to handle but having constraints though. I had tried the recommendations in this link but it didnt work: HBase Kerberos connection renewal strategy
Updated with klist details:
[Fri 04/10 05:30 PM] root@lxapp6479:~# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: uname@domain
Valid starting Expires Service principal
10/04/2019 11:10:19 10/05/2019 11:10:19
krbtgt/DOMAIN@ABC.COM
renew until 10/09/2019 12:32:35
Given the new ticket was renewed @ 10/04, the renew until should have got pushed back to 10/11 but it isnt happening with the below api call:
UserGroupInformation.getLoginUser().checkTGTAndReloginFromKeytab();