krb5_ccache_intro(3)

πŸ“¦
version 7.8.0 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, epel 10, epel 9, fedora 43, fedora 44

πŸ’– NAME πŸ’–

okay bestie, gather round: krb5_ccache_intro β€” the credential cache functions ✨ like, this is THE intro to how Kerberos keeps your tickets in one cozy little spot, iykyk πŸŽ€


🌸 Kerberos credential caches 🌸

so basically, a krb5_ccache structure holds a Kerberos credential cache. that's the whole vibe. it's the lil container where your credentials live πŸ’…

Heimdal supports these types of credential caches, no cap:

  • SCC β€” store the credential in a database
  • FILE β€” store the credential in memory
  • MEMORY β€” store the credential in memory
  • API β€” a credential cache server based solution for Mac OS X
  • KCM β€” a credential cache server based solution for all platforms

(and yes, bestie, FILE says "in memory" up there β€” that's literally what the page says, so I'm repeating it word for word, don't come for me πŸ™ˆ)

πŸ¦‹ Example πŸ¦‹

this is a minimalistic version of klist, and honestly? it ate πŸ”₯

#include <krb5.h>

int
main (int argc, char **argv)
{
    krb5_context context;
    krb5_cc_cursor cursor;
    krb5_error_code ret;
    krb5_ccache id;
    krb5_creds creds;

    if (krb5_init_context (&context) != 0)
        errx(1, "krb5_context");

    ret = krb5_cc_default (context, &id);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_default");

    ret = krb5_cc_start_seq_get(context, id, &cursor);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_start_seq_get");

    while((ret = krb5_cc_next_cred(context, id, &cursor, &creds)) == 0){
        char *principal;

        krb5_unparse_name(context, creds.server, &principal);
        printf("principal: %s\n", principal);
        free(principal);
        krb5_free_cred_contents (context, &creds);
    }
    ret = krb5_cc_end_seq_get(context, id, &cursor);
    if (ret)
        krb5_err(context, 1, ret, "krb5_cc_end_seq_get");

    krb5_cc_close(context, id);

    krb5_free_context(context);
    return 0;
}

and that's the whole page, bestie β€” go forth and cache those credentials responsibly πŸ‘‘

this was Heimdal Kerberos 5 library, Version 7.8.0, dated Tue Nov 15 2022 β€” mwah, signing off πŸ’‹πŸ«Ά

πŸ“¦ where this page comes from