WebTopics

IIS and ASP.NET Information and Tips from Microsoft Developer Support

Service Principal Name (SPN) checklist for Kerberos authentication with IIS 7.0/7.5

Service Principal Name (SPN) checklist for Kerberos authentication with IIS 7.0/7.5

Rate This
  • Comments 27

This post is more about the confusion that may arise around SPNs for setting up Kerberos authentication in IIS 7.0. IIS 7.0 has a new Kernel-mode authentication feature using which the ticket for the requested service is decrypted using Machine account (Local system) of the IIS server. It no longer depends upon the application pool Identity for this purpose by default and in turn improves the performance.

Here is how it looks like.

image

image

So what does this mean?

You no longer need to worry about the correlation between HTTP SPNs and the Application pool Identity that was required in the earlier version i.e. IIS 6.0. But that's not blindly true. There has been some confusion whether we don't have to care at all about SPNs or may have to depending upon the settings. Here is a checklist to give more clarity for different scenarios that you may fall under:

SCENARIO 1a

IIS 7.0 Web Site/Application  
Authentication Integrated Windows authentication
Application Pool Identity NETWORK SERVICE
Kernel-Mode authentication Enabled (<attribute name="useKernelMode" type="bool" defaultValue="true" /> in the ApplicationHost.config file)
Site URL Accessed with the NetBIOS name, like http://<myIISserver-NetBIOS-name>/Default.aspx

SPNs will be required ONLY for the IIS machine account:

HOST/<myIISserver-NetBIOS-name>
HOST/<myIISserver-NetBIOS-name.fully-qualified-domainname> for e.g. HOST/myIISserver.mydomain.com

***Note: By default HOST/<myIISserver-NetBIOS-name> and HOST/<myIISserver-NetBIOS-name.fully-qualified-name> is already added for the machine account when a machine is added to a domain and HTTP forms a part of HOST. So you may not have to do anything special here for SPNs. Everything should be set by default.

You can check the set of existing SPNs for the machine account by running the following command:

> Setspn.exe -L <myIISserver-NetBIOS-name> or directly using a Snap-in like Adsiedit.msc.

SCENARIO 1b

IIS 7.0 Web Site/Application  
Authentication Integrated Windows authentication
Application Pool Identity Custom account for e.g. Domain1\Username1
Kernel-Mode authentication Enabled (<attribute name="useKernelMode" type="bool" defaultValue="true" /> in the ApplicationHost.config file)
Site URL Accessed with the NetBIOS name, like http://<myIISserver-NetBIOS-name>/Default.aspx

The SPN requirements remain the same as above. You don't have to add SPNs like http/<myIISserver-NetBIOS-name> for the Domain1\Username1 unlike in IIS 6.0 (where we had to add an SPN of the form http/<myIISserver-NetBIOS-name> for the Application Pool identity).

SPNs will be required ONLY for the IIS machine account:

HOST/<myIISserver-NetBIOS-name>
HOST/<myIISserver-NetBIOS-name.fully-qualified-domainname> for e.g. HOST/myIISserver.mydomain.com

***Note: By default HOST/<myIISserver-NetBIOS-name> and HOST/<myIISserver-NetBIOS-name.fully-qualified-name> is already added for the machine account when a machine is added to a domain and HTTP forms a part of HOST. So you may not have to do anything special here for SPNs. Everything should be set by default.

You can check the set of existing SPNs for the machine account by running the following command:

> Setspn.exe -L <myIISserver-NetBIOS-name> or directly using Snap-in like Adsiedit.msc.

SCENARIO 2a

IIS 7.0 Web Site/Application  
Authentication Integrated Windows authentication
Application Pool Identity NETWORK SERVICE
Kernel-Mode authentication Enabled (<attribute name="useKernelMode" type="bool" defaultValue="true" /> in the ApplicationHost.config file)
Site URL Accessed with a Custom Host name, like http://www.mysite.com


SPNs will be required ONLY for the IIS machine account in the following format:

HTTP/<site-custom-name> for e.g. HTTP/www.mysite.com

You can add an SPN using Setspn.exe like

> Setspn -a http/<site-custom-name> <myIISserver-NetBIOS-name> 

where <myIISserver-NetBIOS-name> is the IIS machine account and <site-custom-name> is the custom host/host header name for the Web Site URL.

e.g. > Setspn -a http/www.mysite.com <myIISserver-NetBIOS-name>
*The command is NOT case sensitive

You can check the existing set of SPNs for the machine account by running the following command:

> Setspn.exe -L <myIISserver-NetBIOS-name>

 

SCENARIO 2b

IIS 7.0 Web Site/Application  
Authentication Integrated Windows authentication
Application Pool Identity Custom account for e.g. Domain1\Username1
Kernel-Mode authentication Enabled (<attribute name="useKernelMode" type="bool" defaultValue="true" /> in the ApplicationHost.config file)
Site URL Accessed with a Custom host/Host header name, like http://www.mysite.com


SPNs will be required ONLY for the IIS machine account and NOT for Domain1\Username1 account unlike in IIS 6.0.

HTTP/<site-custom-name> for e.g. HTTP/www.mysite.com

You can add an SPN using Setspn.exe like

> Setspn -a http/<site-custom-name> <myIISserver-NetBIOS-name> where <myIISserver-NetBIOS-name> is the IIS machine account and <site-custom-name> is the custom host/host header name for the Web Site URL.

e.g. > Setspn -a http/www.mysite.com <myIISserver-NetBIOS-name>
*The command is NOT case sensitive  

You can check the existing set of SPNs for the machine account by running the following command:

> Setspn.exe -L <myIISserver-NetBIOS-name>

 

Special case of running IIS 7.0 in a WEB FARM

If you are running IIS 7.0 server in a Web farm the KDC will not know in advance which individual server the request may go to and hence ticket decryption may fail. Hence in such a scenario instead of registering SPNs under a specific machine account use a domain account. I am not a SharePoint guy but based on what I have read on the Web this scenario is also applicable to a single SharePoint server configuration.

There are two ways to go:

Either

Disable Kernel mode authentication and follow the general steps for Kerberos as in the previous IIS 6.0 version. Refer this

Or,

[Recommended for Performance reasons]

Let Kernel mode authentication be enabled and the Application pool's identity be used for Kerberos ticket decryption. The only thing you need to do here is:

1. Run the Application pool under a common custom domain account.

2. Add this attribute "useAppPoolCredentials" in the ApplicationHost.config file.

<system.webServer>
   <security>
      <authentication>
         <windowsAuthentication enabled="true" useKernelMode="true" useAppPoolCredentials="true" />
      </authentication>
   </security>
</system.webServer>

Remember there is no GUI setting for this. You need to modify the ApplicationHost.config file from

<%SystemDrive%>/Windows/System32/inetsrv/config folder on the IIS 7.0 machine.

3. Add the SPNs in the form:

http/<virtualhost-name> and

http/<virtualhost-name.fully-qualified-name>  for the Application Pool Identity.

Ensure that we don't have such an entry for SPNs for any other account including IIS server machine account.

*If we have the same SPN mapped to multiple accounts (be it a machine or an user account) it leads to Duplicate SPNs and will break Kerberos.

Hope this helps!

Cross Posted from here

Leave a Comment
  • Please add 5 and 5 and type the answer here:
  • Post
  • PingBack from http://www.qsupport.org/windows-vista-enterprise-64-bit-edition-fix-you-receive-a-stop-0x0000007e-error-message-on-a-blue-screen-when-the-apppoolcredentials-attribute-is-set-to-true-and-you-use-a-domain-account-as-the-appl/

  • There has been a known issue around Server going into a blue screen (OS crash) when you have Windows Authentication and Kernel Mode authentication enabled plus you have the useAppPoolCredentials attribute set to true in the authentication section in the Applicationhost.config file.

    *Ensure that you apply the following hotfix to the IIS 7.0 Server.

    http://support.microsoft.com/kb/962943

  • And for "Special case of running IIS 7.0 in a WEB FARM". The DNS entry for the host header being used must be an A record (not a CNAME point to the NLB name) otherwise Kerberos will fail.

  • Excellent post! Got a little bit confused about the SPN:s when running IIS 7.5

  • Wonderful Post. Cleared lot of confusion. There are very less article on spn and IIS 7. This was most useful.

  • hello,

    how about IIS 7.5.

    The change in the config-File does not work. There are some entries to windowsauthentication.

    The only thing which is working: Disable in IIS the kernel mode authentication.

  • I didn't have luck with this useAppPoolCredentials="true" on IIS 7.5 either. Is there something special required for R2 or are we just missing something?

  • Not that I remember that there should be any difference. I will get back with an update by tomorrow if there is something speical with IIS 7.5.

  • Okay just an update, the above post regarding SPNs is no different in between IIS 7 and IIS 7.5. I feel you are geting into a different issues with regard to Kerberos in general. Ensure all other configuration settings with regard to Kerberos is well configured.

  • I am sorry, that does not work, especially with CRM 4.0.

    IE 8.0/CRM works if deacitivaed kernel mode authenication BUT Outlook-Plugin/CRM cannot be installed.

    If no NLB, only single hosts, with apporpriate SPNs, it does not work IE/CRM 4.0 if kernel mode is activated.

    I have a BIG problem.

    With IIS 6.0 CRM 4.0, NLB, SPNs, etc it had worked.

  • This post is very helpful.

    Thanks

  • I followed IIS 7.5 in  a Web Farm and could not get Kerberos to work until I added provider Negotiate in Authentication section under IIS for the SharePoint website.

  • I followed the IIS 7.0 in  a Web Farm section (My environment IIS 7.5) and could not get Kerberos to work until I added provider Negotiate in Authentication section under IIS for the SharePoint website.

  • Negotiate and NTLM are added by default at the server level. I wonder why you had to manually add it at your site level. It could have been because of someone removing it from global level or sharepoint clearing out all the entries and adding just NTLM to be the only provider.

  • Very useful, we have this working in a mixed 2003/2008 environment and this post was just the information we needed to fill in the gaps and get it working.

Page 1 of 2 (27 items) 12