Closed jborean93 closed 4 months ago
Looks like .NET 9 added the MIC capabilities with https://github.com/dotnet/runtime/pull/96712 through NegotiateAuthentication.ComputeIntegrityCheck-system-buffers-ibufferwriter((system-byte)))). The delegation option is covered by NegotiateAuthenticationServerOptions.RequiredImpersonationLevel set to Delegation
https://github.com/dotnet/runtime/blob/3073a0326a11bfe17776c4ff3c172176dedfe860/src/libraries/System.Net.Security/src/System/Net/NegotiateAuthenticationPal.Unix.cs#L180 so we are all good there!
I've worked on this a bit and was able to get it working. Here is a diff with the basic changes needed. More work would need to be done to deal with error handling and more tidying up of the code. It also uses reflection for .NET 8 as the MIC method was not public until .NET 9.
Nice work!
Can you open a PR?
I can certainly try and tidy it up but I’m unsure what your feeling are around the use of reflection to support .NET 8 and how to deal with the changes in .NET 9 considering only net8.0
is built right now. Testing may also be problematic as while the container can be configured to support Kerberos auth I’m not sure how you want the client side to work if the krb5 libraries are not present.
We can figure these things out as we work on the PR. Here are some thoughts.
use of reflection to support .NET 8 and how to deal with the changes in .NET 9 considering only net8.0 is built right now.
We can add a net9.0
target. And for net8.0
, I'm fine with using reflection if it is fairly limited, which seems to be the case.
I’m not sure how you want the client side to work if the krb5 libraries are not present.
There could be something like a static bool IsSupported { get; }
that tells the user if dependencies are met to use the credential type.
Testing
It would be nice if we can have a test that works in the GitHub CI by installing the necessary dependencies.
The test can be skipped when the IsSupported
condition isn't met.
Thanks, I’ll look at making the changes PR ready. Appreciate the feedback!
I'm not aware what work is involved but it would be great if this supported the
gssapi-with-mic
auth protocol https://datatracker.ietf.org/doc/html/rfc4462. .NET has the NegotiateAuthentication which wraps SSPI on Windows and GSSAPI on non-Windows which should hopefully offer the needed calls to do both authentication and wrapping that's required. I have a suspicion that it may not expose enough detail to achieve using the builtin class, like getting the MIC, or supporting delegation but maybe those are optional extras and .NET could expose a flag for those features in future versions.