Skip to content

Commit

Permalink
kdc: audit canonical client name in AS/TGS
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Dec 19, 2021
1 parent 62c7176 commit 5d45cc1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kdc/kerberos5.c
Expand Up @@ -1861,6 +1861,13 @@ generate_pac(astgs_request_t r, const Key *skey, const Key *tkey)
}

if (!r->client->entry.flags.synthetic) {
char *cpn = NULL;

krb5_unparse_name(r->context, r->client->entry.principal, &cpn);
_kdc_audit_addkv((kdc_request_t)r, 0, "canon_client_name", "%s",
cpn ? cpn : "<unknown>");
krb5_xfree(cpn);

ret = _kdc_pac_add_canon_name_buffer(r->context, p,
r->client_princ,
r->client->entry.principal);
Expand Down
7 changes: 7 additions & 0 deletions kdc/krb5tgs.c
Expand Up @@ -806,6 +806,13 @@ tgs_make_reply(astgs_request_t r,
*/
if (mspac && !et.flags.anonymous) {
if (r->client_princ) {
char *cpn = NULL;

krb5_unparse_name(r->context, r->client_princ, &cpn);
_kdc_audit_addkv((kdc_request_t)r, 0, "canon_client_name", "%s",
cpn ? cpn : "<unknown>");
krb5_xfree(cpn);

ret = _kdc_pac_add_canon_name_buffer(r->context, mspac,
tgt_name, /* client from TGT */
r->client_princ); /* client from PAC */
Expand Down

0 comments on commit 5d45cc1

Please sign in to comment.