Skip to content

Instantly share code, notes, and snippets.

@geosmart
Created September 13, 2021 06:14
Show Gist options
  • Save geosmart/48648b4330a9da298ea61ae2a11f7dc8 to your computer and use it in GitHub Desktop.
Save geosmart/48648b4330a9da298ea61ae2a11f7dc8 to your computer and use it in GitHub Desktop.
print("do klist")
os.system("klist")
krb5 = os.getenv("KRB5_CONFIG")
print("get krb5: {}".format(krb5))
if os.getenv("KRB5_CONFIG") is not None:
keytab = os.getenv("KEYTAB")
principal = os.getenv("PRINCIPAL")
kinit_cmd = "env KRB5_CONFIG={} kinit -kt {} {}".format(krb5, keytab, principal)
print("do kinit: {}".format(kinit_cmd))
os.system(kinit_cmd)
os.system("klist")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment