tl;dr - how do I check details of users' kerberos tickets to confirm they are being renewed as I've sought to configure, using realm or sssd (no klist installed)?
Install klist. For MIT Kerberos the package is krb5-user
and it is harmless; its dependencies (the krb5 libraries) are already installed due to being required by SSSD anyway.
In the somewhat unlikely case that your system might be using Heimdal Kerberos (which is not the default but is supported by Debian), the equivalent package would be heimdal-clients
.
Finally, you could scp
the ticket cache to another system and run klist -c <path>
there (the file-based cache formats are compatible even between MIT Krb5 and Heimdal systems).
Is there a way to show a user's ticket status/details using sssd, realm, or something else I may have already installed/enabled?
No, they're meant to work together with the standard tools from a Kerberos distribution, i.e. you're mostly expected to have the regular klist
installed.
I have noticed the tickets seem to expire after 12-24 hours so I am looking for a way to either request longer-valid tickets up to the maximum my domain will provide, and/or to automatically renew existing tickets and obtain new ones.
24 hours is generally the maximum I would expect a domain to provide. (Longer lifetimes increase the impact of stolen tickets, should that ever happen, as it's impossible to revoke a ticket that's still valid – which is why they have a separate "renewable" lifetime, requiring to contact the KDC again to extend the validity.)
However, the maximum renewable lifetime is generally 7 or 14 days, after which it becomes necessary to supply credentials (password, smartcard) again. Making cronjobs work unattended for longer would require the system to store the initial credentials (like how Windows services or scheduled tasks require you to supply the account's password in clear text).
This is so that I can allow users to schedule tasks using cron and guarantee a valid ticket will be available.
There are several existing methods besides SSSD to do that. (I'm actually not sure whether the version of SSSD found in Debian can renew user tickets on its own; I think that was added later, and even then only for the SSSD-managed KCM:
cache type, not for file-based caches.)
There is most likely no point in relying on the tickets acquired during interactive login (as sooner or later someone will forget to log in before they expire). Instead, have the user explicitly store their actual password – for Linux, it would be in the form of a keytab storing the derived key (not the cleartext password). After all, if you trust the system to permanently store a Kerberos TGT for a user, then the same system can be trusted to secure the password for that user as well.
Once you have a keytab (which can be created using the addent -f
subcommand of ktutil
), there are multiple ways to have a cronjob use that keytab:
The gssproxy daemon, which is a little like ssh-agent but for Kerberos. It comes with an example for NFS which uses keytabs stored at /var/lib/gssproxy/clients/<uid>.keytab
to automatically acquire tickets on behalf of programs configured to use it (for programs using regular libkrb5, that means GSS_USE_PROXY=1
in environment).
One advantage of gssproxy is that it can be given keytabs that are not accessible to the users themselves, similar to how ssh-agent does not allow extraction of the decrypted keys.
The built-in "client credentials" feature in recent libkrb5 which allows you to place a keytab at /var/lib/krb5/user/<uid>/client.keytab
(or at some custom location defined by KRB5_CLIENT_KTNAME=
) and libkrb5 will use it to acquire tickets as needed.
Unlike with gssproxy, this does require the keytab to be readable by the job.
The k5start
tool from the kstart
package, a program that acquires tickets using a keytab and keeps them renewed for the duration of the process that it's running.
A basic kinit -k -t <keytab>
cronjob to re-acquire tickets every few hours.
(If you do want to rely on the existing cache, the same kstart
Debian package also has a krenew
tool which is similar to k5start
except only meant to keep existing tickets renewed.)