Has anyone else struggled with ssh clients being unable to delegate
As far as we can tell, for reasons we still have been unable to
fathom, Microsoft decided that simply permitting credential delegation
based on whether the TGT has the forwardable flag set was
insufficient. Instead, Microsoft implemented a new flag in the MS-SFU >Kerberos Protocol Extensions, TRUSTED_FOR_DELEGATION. The flag is a
property of the service principal of the *target* host: if the target
host does not have the TRUSTED_FOR_DELEGATION flag set in the >userAccountControl attribute of the host’s machine account in Active >Directory, then if the Kerberos library that the ssh client uses
honors the MS-SFU Kerberos Protocol Extensions and honors the >TRUSTED_FOR_DELEGATION flag, it will refuse to delegate the user’s >credentials to the target host, *even* if all other settings would
permit credential delegation.
Has anyone else struggled with ssh clients being unable to delegate
As far as we can tell, for reasons we still have been unable to
fathom, Microsoft decided that simply permitting credential delegation >based on whether the TGT has the forwardable flag set was
insufficient. Instead, Microsoft implemented a new flag in the MS-SFU >Kerberos Protocol Extensions, TRUSTED_FOR_DELEGATION. The flag is a >property of the service principal of the *target* host: if the target
host does not have the TRUSTED_FOR_DELEGATION flag set in the >userAccountControl attribute of the host’s machine account in Active >Directory, then if the Kerberos library that the ssh client uses
honors the MS-SFU Kerberos Protocol Extensions and honors the >TRUSTED_FOR_DELEGATION flag, it will refuse to delegate the user’s >credentials to the target host, *even* if all other settings would
permit credential delegation.
I'm a LITTLE confused as to what you're describing here. As I
understand you, the TRUSTED_FOR_DELEGATION flag doesn't appear on the
wire and only in the account properties. What, exactly, is there for a client implementation to honor or not honor? If you're talking about
the OK-AS-DELEGATE flag in the Kerberos ticket, MIT Kerberos does
implement that flag (but ... the library already provides an option
to ignore that flag and it seems that by default it DOES ignore that
flag). It seems like some versions of Heimdal also will ignore the OK-AS-DELEGATE flag by default and you can configure Heimdal to respect
that flag but I am unclear what the OS X Heimdal does. Calling that a Microsoft extension is incorrect, though, as that appears in RFC 4120.
As for the thinking behind this flaga, well, the RFC provides what I
would consider a cognizant explanation:
https://datatracker.ietf.org/doc/html/rfc4120#section-2.8
If you're talking about something else, I would be curious as to what
you mean. I didn't think ssh could utilize any of the S4U stuff
but it's always possible that could have changed.
I'm a LITTLE confused as to what you're describing here. As I
understand you, the TRUSTED_FOR_DELEGATION flag doesn't appear on
the wire and only in the account properties.
the [MIT Kerberos] library already provides an option to ignore that
[the OK-AS-DELEGATE] flag and it seems that by default it DOES
ignore that flag)
the RFC provides what I would consider a cognizant explanation:
https://datatracker.ietf.org/doc/html/rfc4120#section-2.8
I'd *strongly* encourage you to ignore what OSX comes with in terms
of Kerberos "support" and push to move everything away from what OSX
ships with and to instead use MIT Kerberos. In my experience, this
is far from the only issue you're going to run into with the hacked
up Kerberos from OSX and they don't seem to care to properly
maintain it.
On Mon, Apr 15, 2024 at 7:56 PM Ken Hornstein <kenh@cmf.nrl.navy.mil> wrote:
I'm a LITTLE confused as to what you're describing here. As I
understand you, the TRUSTED_FOR_DELEGATION flag doesn't appear on
the wire and only in the account properties.
Yes. Apologies; I should have been more precise: when Microsoft AD is
acting as the KDC, whether AD sets the the OK-AS-DELEGATE flag in the
TGS-REP is determined by whether the userAccountControl attribute in
Active Directory of the host for which a service ticket is being
requested has the TRUSTED_FOR_DELEGATION flag set. If
TRUSTED_FOR_DELEGATION is set, OK-AS-DELEGATE is set in the TGS-REP; otherwise, OK-AS-DELEGATE is not set in the TGS-REP.
the [MIT Kerberos] library already provides an option to ignore that
[the OK-AS-DELEGATE] flag and it seems that by default it DOES
ignore that flag)
I think the enforce_ok_as_delegate is the option you’re referring to?
The man page claims it is disabled by default (unless an application specifically requests it). That matches our experiences.
Heimdal appears to implement the same option (enforce_ok_as_delegate),
but although the upstream source claims the default is false (do not enforce), Macs seem to enforce it by default. So either Apple has
changed that default in the code, or else they are overriding the
default somewhere in the Kerberos configuration.
In terms of Windows, Microsoft’s Kerberos implementation seems to
enforce compliance with the OK-AS-DELEGATE flag. (PuTTY on Windows
will not delegate a credential unless the target host has the TRUSTED_FOR_DELEGATION flag set in AD.) Perhaps there is a way to
disable this behavior, but we have not yet found a way to do so.
the RFC provides what I would consider a cognizant explanation:
https://datatracker.ietf.org/doc/html/rfc4120#section-2.8
Microsoft provides a similar explanation, but it is still an
unsatisfying one, because it does not speak to our issue: if denying
the ability to delegate a credential (in order to protect it from
exposure to a possibly-untrustworthy host) forces the user to instead
acquire a credential directly from the possibly-untrustworthy host
(thereby exposing the user’s actual password), then this is not a
security improvement. And while I acknowledge that RFC4120 is 19 years
old and a lot has changed since it was originally published, neither
the RFC authors nor Microsoft seems to have considered/predicted this scenario.
On Mon, Apr 15, 2024 at 8:40 PM Stephen Frost <sfrost@snowman.net> wrote:
I'd *strongly* encourage you to ignore what OSX comes with in terms
of Kerberos "support" and push to move everything away from what OSX
ships with and to instead use MIT Kerberos. In my experience, this
is far from the only issue you're going to run into with the hacked
up Kerberos from OSX and they don't seem to care to properly
maintain it.
It has been our experience that ripping out a vendor-supplied
library/package and replacing it with an in-house version almost
always has a higher long-term cost than simply living with whatever
warts the vendor-supplied library/package has. So we are reluctant to
take this approach unless there is truly no other choice.
But this segues back to my original question: how are other sites that
use Microsoft AD as their KDCs handling this?
Are other sites ensuring that the TRUSTED_FOR_DELEGATION flag is set for Linux hosts, so that all various Kerberos libraries (including ones
that enforce OK-AS-DELEGATE by default) will correctly delegate
credentials to Linux hosts?
Are other sites configuring their Kerberos libraries (on a per-OS
basis) to ignore the OK-AS-DELEGATE flag?
Have few other sites that use Microsoft AD as their KDC even run into
this, because they don’t have services (e.g. home directories mounted
via NFSv4+RPCGSS) that require a Kerberos credential, and therefore
don’t need to forward Kerberos credentials to the remote host when
making an ssh connection to it?
My read of the MIT Kerberos kdc.conf man page is that ok-as-delegate
is not one of the flags in default_principal_flags that defaults to
enabled. So heterogeneous sites that use MIT Kerberos as their KDCs
(not AD) should also be seeing this issue.
At least so far, we *think* the best course of action is to always set
the TRUSTED_FOR_DELEGATION flag for Linux hosts in AD, so that
credential delegation won’t depend on whether the Kerberos library
that any specific host uses pays attention to the OK-AS-DELEGATE flag.
And this does seem to be the intention of the TRUSTED_FOR_DELEGATION / OK-AS-DELEGATE flags: it’s advice to Kerberos clients that it’s OK to delegate credentials to the target host, which is exactly what we want
to happen.
The only thing we’re not completely sure about is whether setting the TRUSTED_FOR_DELEGATION flag in AD will have other security
ramifications that aren’t clear from Microsoft’s documentation. Which
is why I was hoping that others on this list have already been down
this particular road and could offer advice.
________________________________________________
Kerberos mailing list Kerberos@mit.edu https://mailman.mit.edu/mailman/listinfo/kerberos
I'm a LITTLE confused as to what you're describing here. As I
understand you, the TRUSTED_FOR_DELEGATION flag doesn't appear on
the wire and only in the account properties.
Yes. Apologies; I should have been more precise: when Microsoft AD is
acting as the KDC, whether AD sets the the OK-AS-DELEGATE flag in the
TGS-REP is determined by whether the userAccountControl attribute in
Active Directory of the host for which a service ticket is being
requested has the TRUSTED_FOR_DELEGATION flag set. If
TRUSTED_FOR_DELEGATION is set, OK-AS-DELEGATE is set in the TGS-REP; >otherwise, OK-AS-DELEGATE is not set in the TGS-REP.
Heimdal appears to implement the same option (enforce_ok_as_delegate),
but although the upstream source claims the default is false (do not >enforce), Macs seem to enforce it by default. So either Apple has
changed that default in the code, or else they are overriding the
default somewhere in the Kerberos configuration.
In terms of Windows, Microsoft’s Kerberos implementation seems to
enforce compliance with the OK-AS-DELEGATE flag. (PuTTY on Windows
will not delegate a credential unless the target host has the >TRUSTED_FOR_DELEGATION flag set in AD.) Perhaps there is a way to
disable this behavior, but we have not yet found a way to do so.
the RFC provides what I would consider a cognizant explanation:
https://datatracker.ietf.org/doc/html/rfc4120#section-2.8
Microsoft provides a similar explanation, but it is still an
unsatisfying one, because it does not speak to our issue: if denying
the ability to delegate a credential (in order to protect it from
exposure to a possibly-untrustworthy host) forces the user to instead
acquire a credential directly from the possibly-untrustworthy host
(thereby exposing the user’s actual password), then this is not a
security improvement. And while I acknowledge that RFC4120 is 19 years
old and a lot has changed since it was originally published, neither
the RFC authors nor Microsoft seems to have considered/predicted this >scenario.
I'd *strongly* encourage you to ignore what OSX comes with in terms
of Kerberos "support" and push to move everything away from what OSX
ships with and to instead use MIT Kerberos. In my experience, this
is far from the only issue you're going to run into with the hacked
up Kerberos from OSX and they don't seem to care to properly
maintain it.
It has been our experience that ripping out a vendor-supplied
library/package and replacing it with an in-house version almost
always has a higher long-term cost than simply living with whatever
warts the vendor-supplied library/package has. So we are reluctant to
take this approach unless there is truly no other choice.
Simo already explained the thinking there, but I think the thing
you're not considering is that not all services require delegated credentials. Yes, in your environment (and ours) delegated
credentials for host principals is essential, but you don't normally
need that for other types of credentials. I haven't run into Simo's experience of badly coded applications delegating credentials when
they shouldn't, but I could believe it happens.
And, well .. one thing I guess I do not understand is, exactly, what
is your problem with turning on that setting on your KDC? If this
is just a cri de cœur about lousy AD admins, fair enough; I can
understand your pain there (most AD admins really don't know how
Kerberos works, sadly).
Speaking about the OK-AS-DELEGATE flag, the ONLY thing that does is
set the flag in the ticket which the client uses as a hint (it is
free to ignore that hint). I cannot speak for the AD
TRUSTED_FOR_DELEGATION flag as a whole; it's possible it does
something else than set the OK-AS-DELEGATE ticket flag.
So if there is NOT a delegation flag on the ticket, the realm-config
entry is checked. If the first byte has the least-significant bit
set, the all of the delegation flags are cleared. I suspect this is
what you're hitting.
I will confess that we supply to our users Kerberos kits which are
all MIT sources, including OpenSSH, for this exact reason; there's
too much weird variance like this.
The correct action is for you to ask the Domain Administrators to
mark the target hosts as ok for delegation, it is unclear why MIT
Kerberos should make it easy to override Realm policies.
Delegating a whole TGT is generally a bad idea, and often clients
are misconfigured to broadly forward it everywhere. That is why
Microsoft took back control in the hands of administrators. It is
not a bad thing, and if your setup has been vetted such that TGT
delegation is an acceptable risk, then it should be easy to get it
fixed the proper way, by getting your domain admins to set the right
flag on the permitted target hosts.
Note that if ticket delegation is needed solely to allow jumping
from hosts to host, you should be able to achieve the same result
via agent forwarding, it would be a safer option.
But all that said I would like to note that it is certainly
inappropriate to call people names before fully understanding the
scope of a security measure, just because it is a little
inconvenient.
As for users that type their passwords onto random hosts, that is a
user education problem in general
but that can be addressed simply by forcing the use of 2FA
authentication on the user's part
preferably via a hardware token and pkinit
I think the core issue here is that RFC4120§2.8 was unclear in
defining the ok-as-delegate flag.
Simo already explained the thinking there, but I think the thing
you're not considering is that not all services require delegated
credentials. Yes, in your environment (and ours) delegated
credentials for host principals is essential, but you don't normally
need that for other types of credentials. I haven't run into Simo's
experience of badly coded applications delegating credentials when
they shouldn't, but I could believe it happens.
Our experience is similar: while I agree it could happen, we have not >encountered it, so it is mystifying to us why Microsoft was so
insistent upon implementing this feature.
It’s not a competency issue: our AD/Windows admins are highly
competent (if I do say so myself), and we Linux admins enjoy good
rapport with them. Rather, they expressed two concerns:
[...]
Upstream Heimdal has the enforce_ok_as_delegate krb5.conf
configuration option, the same as the MIT Kerberos, and like MIT
Kerberos, it defaults to false (only enforced when an application >specifically requests enforcement) (1).
But from testing, ssh on Macs won’t delegate the credential unless the >service ticket of the target host has the ok-as-delegate flag. So
either that’s not the default for Apple’s version of Heimdal, or >something is overriding the default.
I will confess that we supply to our users Kerberos kits which are
all MIT sources, including OpenSSH, for this exact reason; there's
too much weird variance like this.
In the past, we did the same thing, but we reverted to using the >macOS-provided Kerberos implementation, because decisions Apple made
in later macOS releases just made it too painful to replace it (or
even provide an alternative implementation alongside the macOS >implementation).
First off, I would advise you to NOT look at upstream Heimdal, because
that's not helpful because it's not actually the code in question.
Instead maybe look at the actual Heimdal source code used on MacOS X?
I looked at the Apple fork of Heimdal and didn't find any obvious code
change to honor ok-as-delegate by default. In fact, it doesn't even >implement enforce_ok_as_delegate. But both versions do implement a
ccache config setting called "realm-config" and enforce ok-as-delegate
if the 1 bit is set in the first byte of the value. Nothing in Heimdal
or Apple's fork of it sets realm-config, but the macOS native ccache >implementation or login system might do so.
I think the core issue here is that RFC4120§2.8 was unclear in
defining the OK-AS-DELEGATE flag.
I have to say that IMHO, the explanation in RFC 4120 is clear to me
and the current implementations within the MacOS X Kerberos code fall squarely within the scope of the RFCs explanation.
You are, of course, free to express your opinions about the
implementation of these protocols extensions, but ... well, other
than the satisfaction of primal screaming into the void, I'm not
sure how helpful that will be.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:15:42 |
Calls: | 10,389 |
Files: | 14,061 |
Messages: | 6,416,960 |