Skip to content

Commit

Permalink
Allow aliases when matching U2U second ticket
Browse files Browse the repository at this point in the history
In process_tgs_req() when verifying the user-to-user second ticket,
compare the canonical names of the request server and the second
ticket client.

[ghudson@mit.edu: expanded commit message; trimmed tests]

ticket: 8951 (new)
  • Loading branch information
iboukris authored and greghudson committed Sep 22, 2020
1 parent 9fb5f57 commit afc494e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/kdc/do_tgs_req.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ process_tgs_req(krb5_kdc_req *request, krb5_data *pkt,
*/
krb5_enc_tkt_part *t2enc = request->second_ticket[st_idx]->enc_part2;
krb5_principal client2 = t2enc->client;
if (!krb5_principal_compare(kdc_context, request->server, client2)) {
if (!is_client_db_alias(kdc_context, server, client2)) {
altcprinc = client2;
errcode = KRB5KDC_ERR_SERVER_NOMATCH;
status = "2ND_TKT_MISMATCH";
Expand Down
25 changes: 25 additions & 0 deletions src/tests/t_u2u.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,29 @@

realm.run([klist])

realm.stop()

# Load the test KDB module to test aliases
testprincs = {'krbtgt/KRBTEST.COM': {'keys': 'aes128-cts'},
'user': {'keys': 'aes128-cts', 'flags': '+preauth'},
'WIN10': {'keys': 'aes128-cts'}}
kdcconf = {'realms': {'$realm': {'database_module': 'test'}},
'dbmodules': {'test': {'db_library': 'test',
'princs': testprincs,
'alias': {'HOST/win10': 'WIN10'}}}}

realm = K5Realm(kdc_conf=kdcconf, create_kdb=False)
realm.start_kdc()

# Create a second user principal and get tickets for it.
u2u_ccache = 'FILE:' + os.path.join(realm.testdir, 'ccu2u')
realm.extract_keytab('WIN10', realm.keytab)
realm.kinit('WIN10', None, ['-k', '-c', u2u_ccache])

realm.extract_keytab(realm.user_princ, realm.keytab)
realm.kinit(realm.user_princ, None, ['-k'])

realm.run([kvno, '--u2u', u2u_ccache, 'HOST/win10'], expected_msg='kvno = 0')
realm.run([kvno, '--u2u', u2u_ccache, 'WIN10'], expected_msg='kvno = 0')

success('user-to-user tests')

0 comments on commit afc494e

Please sign in to comment.