kinit

igwn_auth_utils.kinit(principal=None, keytab=None, ccache=None)

Initialise a Kerberos ticket-granting ticket (TGT).

The method works in the same way as the kinit command-line tool, with the caveat that it only works with Kerberos keytab files, and does not support interactive input of principal passwords.

Parameters:
  • principal (str, optional) – Principal name for Kerberos credential. If not given it will be taken from the keytab. If principal is not specified in the form name@REALM the default realm REALM will be applied, see man krb5.conf(5).

  • keytab (str, optional) – Path to keytab file. Default taken from KRB5_KTNAME environment variable. This option is required to be not None.

  • ccache (str, optional) – Path to Kerberos credentials cache.

Examples

When KRB5_KTNAME environment variable is set, this function can operate with no arguments:

>>> kinit()

If the Kerberos config (krb5.conf) has a default realm configured, the principal can be specified without that component:

>>> kinit("albert.einstein")