0

I am trying to develop a ASP.NET Core web application which uses Kerberos authentication and delegation to forward the identity of the authenticated user to another REST API (PI Web API). For more information about what exactly I am trying to do, check this question.

Currently, I configured the application to run on IIS by disabling Anonymous Authentication, enabling Windows Authentication and setting Negotiate:Kerberos as the only authentication provider in the Windows Authentication settings.

When I try to open the web application on any machine in the same network (even on the same server the IIS runs on), my user credentials are not accepted and I get a 401 error returned by the IIS. When I check the Security Eventlogs on that server, I can sometimes see a successful logon with Kerberos (event ID 4624) for the user with the credentials I typed into the login dialog in the browser. Strangely, this is not always the case. For example, sometimes I try it again a day later and then there is nothing logged in the Eventlogs at all regarding the login. When I look into the IIS logs for the site, I see entries like this: 2022-05-17 10:57:55 ::1 GET / - 8095 - ::1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko - 401 1 2148074248 609

or this: 2022-05-23 10:48:54 192.168.XXX.XXX GET / - 8095 - 192.168.XXX.XXX Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/101.0.0.0+Safari/537.36 - 401 1 2148074254 8

After consulting our network admin and also doing some research on my own, I cannot figure out what causes these errors and what can be done in order to fix it. Right now I cannot even reproduce any of those errors reliably, because they seem to change from time to time without me even changing anything.

What could be the problem here?

Chris
  • 1,417
  • 4
  • 21
  • 53
  • Ask your domain administrators to collect Kerberos log and see what happens during authentication. You might have to disable kernel mode authentication in certain cases as well. – Lex Li May 17 '22 at 19:00
  • Please check this official doc. [Troubleshoot Kerberos failures in Internet Explorer](https://learn.microsoft.com/en-us/troubleshoot/developer/webapps/iis/www-authentication-authorization/troubleshoot-kerberos-failures-ie) – Jason Pan May 18 '22 at 02:48
  • If you need further help. pls let us know what you have tried. – Jason Pan May 18 '22 at 02:49
  • @LexLi Where can this log be found? – Chris May 18 '22 at 15:05
  • 1
    https://learn.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-kerberos-event-logging – Lex Li May 18 '22 at 15:45
  • @LexLi Thanks for the link! I tried this but unfortunately the only error being logged seems to be "KDC_ERR_PREAUTH_REQUIRED", which should be ignored according to the description which can be found under your link. – Chris May 19 '22 at 13:01
  • Kerberos is touchy and you have to deal with it thoroughly. I would recommend that you start from scratch with a simple hello world page using the HOST SPN, no custom SPN. BTW which tutorial did you use to setup Kerberos? Can you give us more details? E.g. IIS version, SPN, according info from `setspn`, URL you are actually calling etc. Please add such relevant information to your question! – Markus May 30 '22 at 20:47

0 Answers0