kinit#
- gwpy.io.kerberos.kinit(
- username: str | None = None,
- password: str | None = None,
- realm: str | None = None,
- keytab: FileSystemPath | None = None,
- ccache: FileSystemPath | None = None,
- lifetime: int | None = None,
- krb5ccname: str | None = None,
- *,
- verbose: bool | None = None,
Initialise a Kerberos ticket-granting ticket (TGT).
- Parameters:
- username
str, optional Name principal for Kerberos credential, will be prompted for if not given.
- password
str, optional Cleartext password of user for given realm, will be prompted for if not given.
Warning
Passing passwords in plain text presents a security risk, please consider using a Kerberos keytab file to store credentials.
- realm
str, optional Name of realm to authenticate against if not given as part of
username. Defaults to'default_realm'; seeman krb5.conf(5).- keytab
str,Path, optional Path to keytab file. If not given this will be read from the
KRB5_KTNAMEenvironment variable. See notes for more details.- ccache
str,Path, optional Path to Kerberos credentials cache.
- lifetime
int, optional Desired liftime of the Kerberos credential (may not be respected by the underlying GSSAPI implementation); pass
Noneto use the maximum permitted liftime (default).This is currently not respected by MIT Kerberos (the most common GSSAPI implementation).
- verbose
bool, optional DEPRECATED. This argument does nothing, instead of using
verbose=Trueuse logging to control output.- krb5ccname
str, optional DEPRECATED. This argument has been renamed to
ccache.
- username
- Returns:
- creds
gssapi.Credentials The acquired Kerberos credentials.
- creds
Notes
If a keytab is given, or is read from the
KRB5_KTNAMEenvironment variable, this will be used to guess the principal, if it contains only a single credential.Examples
Example 1: standard user input, with password prompt:
>>> kinit('albert.einstein') Password for albert.einstein@LIGO.ORG: Kerberos ticket generated for albert.einstein@LIGO.ORG
Example 2: extract username and realm from keytab, and use that in authentication:
>>> kinit(keytab='~/.kerberos/ligo.org.keytab', verbose=True) Kerberos ticket generated for albert.einstein@LIGO.ORG