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

How to perform ntlm authentication when using alpine as base image? #642

Open
smartaquarius10 opened this issue Jun 8, 2023 · 4 comments

Comments

@smartaquarius10
Copy link

smartaquarius10 commented Jun 8, 2023

Hello,

We are trying to make ntlm authentication call to rest api but error is coming. We have followed the steps mentioned here but, nothing is working. Our application is hosted in Azure AKS. Any suggestions please

Code

               var cred= new CredentialCache();
                cred.Add(new Uri("url"), "NTLM", new NetworkCredential("user", "pwd", "***.com"));

                var hwd= new HttpClientHandler() { Credentials = credentialsCache, PreAuthenticate = true };
                
                hwd.ClientCertificateOptions = ClientCertificateOption.Manual;
                hwd.ServerCertificateCustomValidationCallback =
                    (httpRequestMessage, cert, cetChain, policyErrors) => true;
                hwd.UseDefaultCredentials = false;

                var client = new FlurlClient(new HttpClient(hwd) { Timeout = new TimeSpan(0, 0, 30) };);
                 var response = await request
                    .AllowHttpStatus(HttpStatusCode.NotFound)
                    .WithHeader("Accept", "application/json")
                    .WithClient(client)
                    .WithHeader("Content-Type", "application/json; charset=utf-8")
                    .GetAsync();

Exception

Flurl.Http.FlurlHttpException: Call failed. NTLM authentication is not possible with default credentials on this platform: 
System.PlatformNotSupportedException: NTLM authentication is not possible with default credentials on this platform. at

POD base image


NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.3
PRETTY_NAME="Alpine Linux v3.16"

dotnet version:- 6.0.14

@smartaquarius10
Copy link
Author

Hey @Maoni0 @richlander, sorry for tagging you directly. If possible could you please help us here. Our production environment is impacted because of this issue. Would be grateful for help and support.

@Maoni0
Copy link
Member

Maoni0 commented Jun 8, 2023

@mangod9 do you know who might be able to help with this?

@mangod9
Copy link
Member

mangod9 commented Jun 8, 2023

Looks to be related to this issue: dotnet/runtime#66633. Might make sense to discuss on that issue.

@smartaquarius10
Copy link
Author

Thank you so much @Maoni0 @mangod9

We entered into a war room yesterday for 7 hours but unable to figure out anything. As a backup plan we can only change the base image from alpine to someone else. But, it requires approvals and lots of changes in our ci/cd pipelines.

Once you have any updates please let me know. Really appreciate. Have a great weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants