KRB5_VERIFY_INIT_CREDS(3)

πŸ’– KRB5_VERIFY_INIT_CREDS πŸ’–

okay bestie, so this is a page from the Library Functions Manual of your local system, and it's all about krb5_verify_init_creds β€” the three lil functions that check your credential cache is actually legit by comparing it against a local keytab. no cap, this is the security girlie of the Kerberos family. πŸ”βœ¨


πŸŽ€ NAME πŸŽ€

krb5_verify_init_creds_opt_init, krb5_verify_init_creds_opt_set_ap_req_nofail, krb5_verify_init_creds β€” these verify that a credential cache is correct by using a local keytab. literally their whole job. πŸ’…


πŸ“š LIBRARY πŸ“š

Kerberos 5 Library β€” that's libkrb5, and you link it with -lkrb5. bestie behavior.


✨ SYNOPSIS ✨

so first you gotta pull in the header:

#include <krb5.h>

and there's this lil opaque struct hanging out:

struct krb5_verify_init_creds_opt;

then the three icons themselves:

void
krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *options);

void
krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt *options,
    int ap_req_nofail);

krb5_error_code
krb5_verify_init_creds(krb5_context context, krb5_creds *creds,
    krb5_principal ap_req_server, krb5_ccache *ccache,
    krb5_verify_init_creds_opt *options);

🌸 DESCRIPTION 🌸

okay so the main character here is krb5_verify_init_creds. what it does is it verifies the initial tickets against the local keytab β€” the whole point being to make sure the response that came back from the KDC wasn't spoof-ed. yes, spoof-ed, with the little hyphen, that's exactly how the page says it and we respect it. πŸ‘‘

krb5_verify_init_creds will use the principal ap_req_server from the local keytab. and if you pass in NULL? it's giving detective energy β€” the code will guess the local hostname and use that to form host/hostname/GUESSED-REALM-FOR-HOSTNAME. cute, right? it's just out here guessing.

then creds is the credential that krb5_verify_init_creds should verify. that's the thing under the microscope. πŸ”

and if ccache is given, krb5_verify_init_creds() stores all credentials it fetched from the KDC in there. but if you don't give it one? it'll use a memory credential cache that gets destroyed when it's done. ephemeral queen. gone but not forgotten. πŸ’€βœ¨

now, krb5_verify_init_creds_opt_init() cleans the the structure β€” yeah, "the the", we're keeping it, it's iconic β€” and it must be used before you try to pass that structure into krb5_verify_init_creds(). like, mandatory. no skipping steps bestie. 🫢

and krb5_verify_init_creds_opt_set_ap_req_nofail() controls controls β€” again, keeping the double, it's part of the vibe β€” the behavior if ap_req_server doesn't exist in the local keytab or in the KDC's database. if it's true, the error will be ignored.

⚠️ Note that this use is possible insecure. so like... be careful. this is the "turn off the smoke alarm because the toast is fine" option. it might be fine. it might not. πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, they're all linked:


and that's the whole page, bestie!! this one came to you from HEIMDAL, dated May 1, 2006, and it lives under the name KRB5_VERIFY_INIT_CREDS(3). go verify those creds. slay. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from