KRB5_GET_IN_TKT(3)

πŸ’– KRB5_GET_IN_TKT β€” ok bestie, sit down, we gotta talk πŸ’–

so this is the krb5_get_in_tkt(3) page from the Kerberos 5 Library β€” manual section 3, library functions, and the whole squad here is:

  • krb5_get_in_tkt
  • krb5_get_in_cred
  • krb5_get_in_tkt_with_password
  • krb5_get_in_tkt_with_keytab
  • krb5_get_in_tkt_with_skey
  • krb5_free_kdc_rep
  • krb5_password_key_proc

and what are they, collectively? deprecated initial authentication functions. yeah. that's the vibe. 😭


πŸ“š LIBRARY

Kerberos 5 Library (libkrb5, link it with -lkrb5) 🫢


✨ SYNOPSIS ✨

#include <krb5.h>

krb5_error_code
krb5_get_in_tkt(krb5_context context, krb5_flags options,
    const krb5_addresses *addrs, const krb5_enctype *etypes,
    const krb5_preauthtype *ptypes, krb5_key_proc key_proc,
    krb5_const_pointer keyseed, krb5_decrypt_proc decrypt_proc,
    krb5_const_pointer decryptarg, krb5_creds *creds,
    krb5_ccache ccache, krb5_kdc_rep *ret_as_reply);

krb5_error_code
krb5_get_in_cred(krb5_context context, krb5_flags options,
    const krb5_addresses *addrs, const krb5_enctype *etypes,
    const krb5_preauthtype *ptypes, const krb5_preauthdata *preauth,
    krb5_key_proc key_proc, krb5_const_pointer keyseed,
    krb5_decrypt_proc decrypt_proc, krb5_const_pointer decryptarg,
    krb5_creds *creds, krb5_kdc_rep *ret_as_reply);

krb5_error_code
krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options,
    krb5_addresses *addrs, const krb5_enctype *etypes,
    const krb5_preauthtype *pre_auth_types, const char *password,
    krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply);

krb5_error_code
krb5_get_in_tkt_with_keytab(krb5_context context, krb5_flags options,
    krb5_addresses *addrs, const krb5_enctype *etypes,
    const krb5_preauthtype *pre_auth_types, krb5_keytab keytab,
    krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply);

krb5_error_code
krb5_get_in_tkt_with_skey(krb5_context context, krb5_flags options,
    krb5_addresses *addrs, const krb5_enctype *etypes,
    const krb5_preauthtype *pre_auth_types, const krb5_keyblock *key,
    krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply);

krb5_error_code
krb5_free_kdc_rep(krb5_context context, krb5_kdc_rep *rep);

krb5_error_code
krb5_password_key_proc(krb5_context context, krb5_enctype type,
    krb5_salt salt, krb5_const_pointer keyseed, krb5_keyblock **key);

like. look at those argument lists. they're giving "the 2003 called and it wants its API surface back" πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

ok so first things first, and I need you to hear me on this one:

every single function on this page is deprecated in the MIT implementation, and they're about to be deprecated in Heimdal too. do NOT use them. like, not even a little. it's giving expired milk. πŸ₯›πŸ’€

Now, the actual lore. These functions get you an initial credential ticket for a principal β€” that's the whole job. And here's the tea: krb5_get_in_cred is the main character. Every other krb5_get_in function uses it under the hood to fetch tickets. The rest are just more specialized, and therefore somewhat easier to use. slay, I guess. πŸ’…

If literally all you need is to verify a user and a password? Bestie, consider krb5_verify_user(3) instead β€” it has a much simpler interface. do yourself a favor. πŸ™ˆ


🌸 the actual functions

krb5_get_in_tkt and krb5_get_in_cred both fetch the initial credential, and both go querying for a key using the key_proc argument. The difference between the two? The way they store things, and it's honestly the whole plot twist:

  • krb5_get_in_tkt stores the credential in a krb5_creds
  • krb5_get_in_cred stores the credential in a krb5_ccache

krb5_get_in_tkt_with_password, krb5_get_in_tkt_with_keytab, and krb5_get_in_tkt_with_skey all do the exact same work as krb5_get_in_cred, they're just more specialized. ✨

  • krb5_get_in_tkt_with_password β€” uses the client's password to authenticate. If the password argument is NULL, the user gets queried with the default password query function. (yes, the user. queried. 🫢)
  • krb5_get_in_tkt_with_keytab β€” searches the given keytab for a service entry for the client principal. If the keytab is NULL, the default keytab is used.
  • krb5_get_in_tkt_with_skey β€” uses a key to get the initial credential.

πŸ’œ the common arguments (iykyk)

There are some shared arguments across the krb5_get_in functions, so let's break them down:

  • options β€” these are the KDC_OPT flags.
  • etypes β€” a NULL terminated array of encryption types that the client approves. πŸ’…
  • addrs β€” a list of the addresses that the initial ticket... yeah, that's what the page says, don't look at me. If it's NULL, the list will be generated by the library. 🧚
  • pre_auth_types β€” a NULL terminated array of pre-authentication types. If pre_auth_types is NULL, the function will try without pre-authentication and return those pre-authentication that the KDC returned.
  • ret_as_reply β€” will (if not NULL) be filled in with the response of the KDC, and should be freed with krb5_free_kdc_rep().
  • key_proc β€” a pointer to a function that should return a key salted appropriately. Using NULL will use the default password query function.
  • decrypt_proc β€” using NULL will use the default decryption function.
  • decryptarg β€” will be passed to the decryption function decrypt_proc.
  • creds β€” creds should be filled in with the template for a credential that should be requested. The client and server elements of the creds structure must be filled in. Upon return of the function it will contain the content of the requested credential (krb5_get_in_cred), or it will be freed with krb5_free_creds(3) (all the other krb5_get_in functions). πŸ‘€
  • ccache β€” will store the credential in the credential cache ccache. The credential cache will not be initialized β€” that's up to the caller. no hand-holding here bestie. 😌

πŸŽ€ the helper besties

krb5_password_key_proc is a library function that's suitable for using as the krb5_key_proc argument to krb5_get_in_cred or krb5_get_in_tkt. keyseed should be a pointer to a NUL terminated string, or NULL. And krb5_password_key_proc will query the user for the pass on the console if the password isn't given as the argument keyseed. iconic behavior honestly. 🌸

krb5_free_kdc_rep() frees the content of rep. that's it. that's the whole function. free it. πŸ¦‹


πŸ‘€ SEE ALSO

krb5(3), krb5_verify_user(3), krb5.conf(5), kerberos(8)


and that's the whole page bestie!! this one's from the HEIMDAL manual, dated May 31, 2003, filed under KRB5_GET_IN_TKT(3) β€” and no cap, if you actually need to use any of this, please just go read krb5_verify_user(3) instead. periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from