Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntml windows is work,linux not work #110371

Open
sibo-git opened this issue Nov 27, 2024 · 9 comments
Open

ntml windows is work,linux not work #110371

sibo-git opened this issue Nov 27, 2024 · 9 comments
Labels
area-System.Net.Http needs-author-action An issue or pull request that requires more info or actions from the author. question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@sibo-git
Copy link

sibo-git commented Nov 27, 2024

Describe the bug
The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'Negotiate, NTLM'.

To Reproduce

public void InitService(string ewsUrl, string username, string password, string domain)
{

   BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
   {
       MaxReceivedMessageSize = 65536,
       Security =
       {
           Transport = new HttpTransportSecurity
           {
               ClientCredentialType = HttpClientCredentialType.Ntlm
           }
       },
       UseDefaultWebProxy = false
   };

   EndpointAddress endpoint = new EndpointAddress(new Uri(ewsUrl));


   ExchangeServicePortTypeClient client = new ExchangeServicePortTypeClient(binding, endpoint);
   
   client.ClientCredentials.UserName.UserName = username;
   client.ClientCredentials.UserName.Password = password;

   _ExchangeServicePortTypeClient = client;
}

await _ExchangeServicePortTypeClient.CreateItemAsync(request);
```
`

**Expected behavior**
The service should successfully authenticate with NTLM and process the request.


@HongGit
Copy link
Contributor

HongGit commented Dec 3, 2024

WCF Client just pass the credentials to HttpClientHandler using CredentialCache for NTLM scheme. Any issues not working is something for runtime team to investigate, pass to .NET runtime.

@HongGit HongGit transferred this issue from dotnet/wcf Dec 3, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 3, 2024
@wfurt
Copy link
Member

wfurt commented Dec 3, 2024

.NET depends on OS implementation. For Linux you will need gss-ntlmssp package installed. What distribution and .NET version do you use @sibo-git?

@wfurt wfurt added needs-author-action An issue or pull request that requires more info or actions from the author. and removed untriaged New issue has not been triaged by the area owner labels Dec 3, 2024
@wfurt wfurt added this to the Future milestone Dec 3, 2024
@sibo-git
Copy link
Author

sibo-git commented Dec 4, 2024

WSL ubuntu22.04 net8.0,and apt install gss-ntlmssp ok。
Image

@dotnet-policy-service dotnet-policy-service bot added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Dec 4, 2024
@sibo-git
Copy link
Author

sibo-git commented Dec 4, 2024

WCF Client just pass the credentials to HttpClientHandler using CredentialCache for NTLM scheme. Any issues not working is something for runtime team to investigate, pass to .NET runtime.

WSL net8.0,and apt install gss-ntlmssp not ok。

@ManickaP
Copy link
Member

ManickaP commented Dec 4, 2024

Problem's been figured out, closing.

@ManickaP ManickaP closed this as completed Dec 4, 2024
@sibo-git
Copy link
Author

sibo-git commented Dec 5, 2024

Sorry, due to my oversight, I mistakenly described it as successful. In fact, I am still failing, even though I have already installed gss-ntlmssp.

@ManickaP
Copy link
Member

ManickaP commented Dec 5, 2024

So could you try on a normal ubuntu install (can be VM in Hyper-V, but not WSL)? What version of WSL are you using? Is it working / not working on a different machine? What version of .NET are you using?

And lastly, could you do a packet capture (wireshark) and share it?

@ManickaP ManickaP reopened this Dec 5, 2024
@ManickaP ManickaP added question Answer questions and provide assistance, not an issue with source code or documentation. needs-author-action An issue or pull request that requires more info or actions from the author. and removed needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration labels Dec 5, 2024
Copy link
Contributor

This issue has been marked needs-author-action and may be missing some important information.

@wfurt
Copy link
Member

wfurt commented Dec 5, 2024

how do you set domain name @sibo-git ? It still may be worth to try simple repro without WCF ... just to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net.Http needs-author-action An issue or pull request that requires more info or actions from the author. question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests

4 participants