Isaac Boukris
2018-09-18 16:12:18 UTC
Hello Greg, all,
I've been working lately on cross-realm s4u2self in samba code and
would like to consult about MIT's current handling and possibly needed
changes.
See last emails on samba-technical thread (it's a long one, spans over
a few months):
https://lists.samba.org/archive/samba-technical/2018-September/130044.html
Heimdal and Samba PRs:
https://github.com/heimdal/heimdal/pull/403
https://github.com/samba-team/samba/pull/204
In short, for cross-realm s4u2self requests we need a way to sign and
verify the PAC including the realm, that is ***@realm for a regular
principal name, and ***@realm@realm for an enterprise one.
See attached prove-of-concept patches for mit-krb5 and samba with
which cross-realm s4u2self works both ways (tested manually against
windows too).
I'd like to start with the last commit in the MIT patch, which
partially reverts 8a9909ff9ef6b51c5ed09ead6713888fbb34072f commit,
that I don't fully understand.
In cross-realm s4u2self, a service starts by requesting the ticket
from a KDC in the impersonated principal's realm, and then follows
back referrals to its own realm.
The kdc code handles this correctly in several places apart of this
error when is_referral is true, introduced by the above commit.
I think it even contradicts the below sections in 'do_tgs_req.c':
if (isflagset(c_flags, KRB5_KDB_FLAG_PROTOCOL_TRANSITION) &&
!isflagset(c_flags, KRB5_KDB_FLAG_CROSS_REALM))
enc_tkt_reply.client = s4u_x509_user->user_id.user;
else
enc_tkt_reply.client = subject_tkt->client;
This code is a bit tricky as usually KRB5_KDB_FLAG_CROSS_REALM means
that the client is not in local realm so he probably came with a
referral tgt, but not necessarily that we are currently issuing a
referral.
But in cross-realm s4u2self, since the tgt-client and the server are
the same principal, it means we are issuing a referral and that's
exactly what this code is checking in order to set the returned cname
and crealm.
However, with the above commit we won't reach here in case of referral
as we'd error out before.
BTW, I think using the new is_referral instead of
KRB5_KDB_FLAG_CROSS_REALM in this code would be clearer and more
correct (as it is based on db lookup).
Thought?
Thank you!
I've been working lately on cross-realm s4u2self in samba code and
would like to consult about MIT's current handling and possibly needed
changes.
See last emails on samba-technical thread (it's a long one, spans over
a few months):
https://lists.samba.org/archive/samba-technical/2018-September/130044.html
Heimdal and Samba PRs:
https://github.com/heimdal/heimdal/pull/403
https://github.com/samba-team/samba/pull/204
In short, for cross-realm s4u2self requests we need a way to sign and
verify the PAC including the realm, that is ***@realm for a regular
principal name, and ***@realm@realm for an enterprise one.
See attached prove-of-concept patches for mit-krb5 and samba with
which cross-realm s4u2self works both ways (tested manually against
windows too).
I'd like to start with the last commit in the MIT patch, which
partially reverts 8a9909ff9ef6b51c5ed09ead6713888fbb34072f commit,
that I don't fully understand.
In cross-realm s4u2self, a service starts by requesting the ticket
from a KDC in the impersonated principal's realm, and then follows
back referrals to its own realm.
The kdc code handles this correctly in several places apart of this
error when is_referral is true, introduced by the above commit.
I think it even contradicts the below sections in 'do_tgs_req.c':
if (isflagset(c_flags, KRB5_KDB_FLAG_PROTOCOL_TRANSITION) &&
!isflagset(c_flags, KRB5_KDB_FLAG_CROSS_REALM))
enc_tkt_reply.client = s4u_x509_user->user_id.user;
else
enc_tkt_reply.client = subject_tkt->client;
This code is a bit tricky as usually KRB5_KDB_FLAG_CROSS_REALM means
that the client is not in local realm so he probably came with a
referral tgt, but not necessarily that we are currently issuing a
referral.
But in cross-realm s4u2self, since the tgt-client and the server are
the same principal, it means we are issuing a referral and that's
exactly what this code is checking in order to set the returned cname
and crealm.
However, with the above commit we won't reach here in case of referral
as we'd error out before.
BTW, I think using the new is_referral instead of
KRB5_KDB_FLAG_CROSS_REALM in this code would be clearer and more
correct (as it is based on db lookup).
Thought?
Thank you!