This repository was archived by the owner on Jan 23, 2023. It is now read-only.
[release/3.0] Fix SocketsHttpHandler proxy auth for 'Negotiate' scheme#39981
Merged
wtgodbe merged 1 commit intodotnet:release/3.0from Aug 5, 2019
Merged
[release/3.0] Fix SocketsHttpHandler proxy auth for 'Negotiate' scheme#39981wtgodbe merged 1 commit intodotnet:release/3.0from
wtgodbe merged 1 commit intodotnet:release/3.0from
Conversation
Issue #39887 reported that proxy authentication with 'Negotiate' scheme broke between .NET Core 3.0 Preview 6 and Preview 7. The base64 blob was no longer using SPNEGO protocol but instead was always using NTLM. While 'Negotiate' scheme can use either SPNEGO or NTLM, it should always use SPNEGO if possible. And many enterprises have a setting which requires it and rejects NTLM protocol. This issue was caused by PR dotnet#38465 which fixed some other SPN issues with Kerberos authentication. That PR regressed the SPN calculation for the proxy authentication by using the wrong host name in the SPN. A mismatch of the SPN will cause NTLM to be used instead of SPNEGO. The fix is to check if proxy authentication is being used instead of server authentication. If so, it ignores any 'Host' header and always will use the uri, which in this case is the uri of the proxy server. This was tested manually. It is impossible right now to test Kerberos and proxy scenarios in CI because they require machine configuration to register SPNs in a Windows Active Directory environment. This PR will be ported for release/3.0 for ASK mode consideration since it affects a mainline enterprise scenario. Fixes #39887
Contributor
Author
DescriptionFix SocketsHttpHandler proxy auth for 'Negotiate' scheme. Customer ImpactCustomers using an authenticating proxy using Negotiate/Kerberos in their network are unable to send any requests. Regression?Yes. This regressed from .NET Core 3.0 Preview 6 to Preview 7 due to PR #38465 RiskLow risk. Test changes in this PRAdded new unit test to verify that Negotiate authentication to a proxy will use Kerberos token and not NTLM tokens. |
Contributor
Author
|
cc: @danmosemsft |
Member
|
This was approved by tactics for preview8, merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of PR #39933 to release/3.0
Issue #39887 reported that proxy authentication with 'Negotiate' scheme broke between
.NET Core 3.0 Preview 6 and Preview 7. The base64 blob was no longer using SPNEGO protocol
but instead was always using NTLM. While 'Negotiate' scheme can use either SPNEGO or NTLM,
it should always use SPNEGO if possible. And many enterprises have a setting which requires
it and rejects NTLM protocol.
This issue was caused by PR #38465 which fixed some other SPN issues with Kerberos
authentication. That PR regressed the SPN calculation for the proxy authentication by
using the wrong host name in the SPN. A mismatch of the SPN will cause NTLM to be used
instead of SPNEGO.
The fix is to check if proxy authentication is being used instead of server authentication.
If so, it ignores any 'Host' header and always will use the uri, which in this case is the
uri of the proxy server.
This was tested manually. It is impossible right now to test Kerberos and proxy scenarios in
CI because they require machine configuration to register SPNs in a Windows Active Directory
environment.
This PR will be ported for release/3.0 for ASK mode consideration since it affects a mainline
enterprise scenario.
Fixes #39887