Κέρβερος, the
three-headed guard dog
Troubleshooting
the 401.1 - Unauthorized: Access is denied due to invalid credentials
Trouble-shooting the 401.1
when an IIS website is set to using Windows Integrated / Negotiate (Kerberos or
NTLMv2) authentication
in single hop and double hop
scenarios
by vIISual.net(at)hotmail(dot)com
updated May 2010. But this is unfinished. There is a lot left to do on this page.
Confirm
the error message. There are several
types of 401 errors. The 401.1 is very
different than the 401.2 and 401.3. Here
is the 401.1 as seen in the IE 7 browser:
You do not have permission to view this directory or page
using the credentials that you supplied.
Please try the following:
·
Contact the Web site administrator
if you believe you should be able to view this directory or page.
·
Click the Refresh button to try again with
different credentials.
Technical Information (for support personnel)
·
Go to Microsoft Product Support
Services and perform a title search for the words HTTP and 401.
·
Open IIS Help, which is
accessible in IIS Manager (inetmgr), and search for
topics titled Authentication, Access Control, and About Custom
Error Messages.
Here
is an example of the 401.1 as seen in the IIS logs
#Software:
Microsoft Internet Information Services 6.0
#Version:
1.0
#Date:
2010-04-22 14:36:47
#Fields:
date time s-sitename s-ip cs-method cs-uri-stem
cs-uri-query s-port cs-username c-ip cs(User-Agent)
sc-status sc-substatus
sc-win32-status
2010-04-22 14:40:48 W3SVC1655145481 172.25.5.32 GET
/admin.asp - 80 MYCORP\hobbsj 172.25.5.32 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+Trident/4.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729)
401 1 0
The
default location for IIS6 is c:\windows\system32\logfiles\w3svc. For IIS7 it is
c:\inetpupb\logs\logfiles\w3svc. Note how
the 401.1 shows up as 401 1 (status code substatus
code). This assumes that the IIS logging
properties of the website in focus is set to log the sc-substatus
code.
Some Client (IE) Considerations
Same Domain?
For both kerberos authentication
and/or NTLMv2 authentication to work the client (Internet Explorer preferably) has
to be joined to the domain that the web server is in. (Or it has to be in a domain with proper
trusts set up to/from the target domain.)
Unhindered Communication?
The client, the web server, and the domain
controller (the KDC – key distribution center) need to be able to communicate
with one another over certain ports. If
a firewall, for example, has port 88 or 464 locked down Kerberos authentication
may not work. NTLM may be able to work
when those ports are locked down, however.
Still, don’t expect Windows authentication to work when the clients are
anonymous clients hitting a webserver from across the internet. The clients are not part of a trusted domain
to begin with. And what is more, the KDC
is almost certainly protected by a firewall of some kind. It is possible to occasionally get NTLM
authentication to work for a client hitting a website across the internet
because the client might get prompted for credentials and those credentials
might be accepted. However, at this point
it would be better to rely on Basic Authentication with SSL rather than
NTLM. Neither NTLM nor Kerberos are
meant to work across the internet.
Browser
Version:
The client browser must be Internet Explorer
v5.0 or higher--not Firefox, Netscape, Mozilla, etc.
NTLM or Kerberos?
One thing that can be helpful is to confirm
that the IE browser is set to be able to do Kerberos. Click the IE Tools menu select “Internet
Options” and select the Advanced Tab. Scroll down to the setting for “Enable
Integrated Windows Authentication.”
This should be checked by default.
If it is not check marked, you can expect your client to try to do NTLMv2
authentication but not attempt to do Kerberos authentication. If you uncheck this and restart IE, you can
test the authentication with NTLM. If it works with NTLM but not with Kerberos that is sometimes good
to know.

Which
IE Zone?
Note whether the address of the website the
client is trying to hit is or is not listed in the IE intranet zone list or the
IE trusted sites list.
Look in the lower right corner of IE after
browsing to the website to see which Zone IE has recognized the website to be
in.

In IE, select the Tools menu > Internet Options > Security Tab.
Select
Intranet Sites

Click the “Custom Level” button.

For NTLM and Integrated authentication
methods to work, it is best that the IE client have “Automatic logon only in
Intranet Zone” set (which it usually is by default unless a group policy has
changed it) and for the URL that the client is browsing to to
be listed in the “Local Intranet” zone list of the client. Many people make the mistake of setting the
site in the “Trusted sites” zone list.
But that is for internet sites, not intranet sites. And the magic of the automatic logon is only
going to occur if that site is in the local intranet site list. If the website you’re browsing to has a
period/dot in it, Internet Explorer is going to assume that the site belongs in
the Internet zone (not the Local intranet) and will attempt to authenticate
accordingly. Don’t expect NTLM or Kerberos
authentication to work if the address is an IP address (example: http://64.113.15.3)
or a fqdn of a server
(example: http://webserver1.mydomain.local). But if you add the address to the local
intranet zone, you are one step closer.

Tools
SetSPN (Windows 2000) –
from the 2000 reskit… setspn-o.asp
SetSPN (Windows 2003) – kb
892777 – windows server 2003 service pack 1 32-bit support tools
Check c:\program files\support tools\setspn.exe
Delegconfig v1 andDelegconfig v2 Beta
Kerbtray – can be
run on the workstation to show which kerberos tickets
it is holding
Confirm that “Windows
Authentication” is set as the ONLY authentication
method set in IIS.
Service Principle
Names (“SPNs”) Considerations
To list all
the SPNs associated with a specific server, run this:
Setspn –L domain\useraccountname
And log off
and log on with client
Do two
different user accounts have ties to the same http\fqdn
SPN? If so, it’s a problem.
Let’s say we
have in DNS an (A)Host record for “MyGreatWebApp.”
Here is how
you would add the needed SPN:
Setspn –A HTTP/mygreatwebapp
DomainName\Mywebserviceaccount
If you prefer
to browse to the servername, however, the SPN would
need to be added as follows:
Setspn –A HTTP/servername DomainName\Mywebserviceaccount
Active
Directory Considerations
Is the IIS
web server trusted for delegation?
Open ADUC
(Active Directory Users and Computers)
Find the IIS
server’s computer account and go to its properties sheet
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/tkerbdel.mspx
Troubleshooting Kerberos Delegation
http://support.microsoft.com/default.aspx?scid=kb;EN-US;871179
How to configure SQL Server 2005 Analysis Services to use Kerberos authentication
http://support.microsoft.com/default.aspx?scid=kb;EN-US;917409
http://support.microsoft.com/default.aspx?scid=kb;EN-US;916962
319723 How to use Kerberos authentication in SQL Server
http://support.microsoft.com/default.aspx?scid=kb;EN-US;319723
http://support.microsoft.com/default.aspx?scid=kb;EN-US;325894
326985 HOW TO: Troubleshoot Kerberos-Related Issues in IIS
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326985
http://support.microsoft.com/default.aspx?scid=kb;EN-US;828280
http://support.microsoft.com/default.aspx?scid=kb;EN-US;840219
907272 Kerberos authentication and troubleshooting delegation issues
http://support.microsoft.com/default.aspx?scid=kb;EN-US;907272
917409 How to configure SQL Server 2005 Analysis Services to use Kerberos authentication
http://support.microsoft.com/default.aspx?scid=kb;EN-US;917409
http://support.microsoft.com/default.aspx?scid=kb;EN-US;911149
(explains why you’ll want to use an A record rather than an Alias record in dns)
892777 - Windows Server 2003 Service Pack 1 Support Tools
http://support.microsoft.com/default.aspx?scid=kb;EN-US;892777
(Tells how to get the SetSpn utility)
917409 - How to configure SQL Server 2005 Analysis Services to use Kerberos authentication
http://support.microsoft.com/default.aspx?scid=kb;EN-US;917409
http://support.microsoft.com/default.aspx?scid=kb;EN-US;916962
http://support.microsoft.com/default.aspx?scid=kb;EN-US;909801
http://support.microsoft.com/default.aspx?scid=kb;EN-US;871179
http://www.zeroshell.net/eng/kerberos/Kerberos-operation/
Kerberos
Authentication Protocol
262177 How to enable Kerberos event logging
http://support.microsoft.com/default.aspx?scid=kb;EN-US;262177
What do
security event logs say on the MS SQL machine?
(may need to increase auditing first)
917409 How to configure SQL Server 2005 Analysis Services to
use Kerberos authentication
http://support.microsoft.com/default.aspx?scid=kb;EN-US;917409
http://support.microsoft.com/default.aspx?scid=kb;EN-US;916962
http://support.microsoft.com/default.aspx?scid=kb;EN-US;909801
http://support.microsoft.com/default.aspx?scid=kb;EN-US;911149
http://support.microsoft.com/default.aspx?scid=kb;EN-US;938305
Can run kerbtray
here to see if made ticket with a competing SPN