Home > IIS > Client certificate mapping in IIS 7 and impersonation

Client certificate mapping in IIS 7 and impersonation

Recently, when migrating an application that uses client certificate authentication to IIS 7, we noticed that ASP.NET impersonation stopped working.

Client was authenticated properly, but connection to database server was being established with machine account (DOMAIN\SERVERNAME$). We didn’t find any issue in the configuration, so we raised the case with Microsoft support.

It turns out one of IIS 7 default configuration files has a bug. The file is called C:\Windows\System32\inetsrv\config\schema\IIS_schema.xml, and under the following section there are wrong enum entries:

<sectionSchema name="system.webServer/security/authentication/iisClientCertificateMappingAuthentication">
<attribute name="logonMethod" type="enum" defaultValue="ClearText">
<enum name="Interactive" value="0" />
<enum name="Batch" value="1" />
<enum name="Network" value="2" />
<enum name="ClearText" value="3" />
</attribute>
</sectionSchema>

And that causes IIS to use wrong logonMethod when logging in with an impersonated certificate-mapped account. The correct values to be set there are:

<sectionSchema name="system.webServer/security/authentication/iisClientCertificateMappingAuthentication">
<attribute name="logonMethod" type="enum" defaultValue="ClearText">
<enum name="Interactive" value="2" />
<enum name="Batch" value="4" />
<enum name="Network" value="3" />
<enum name="ClearText" value="8" />
</attribute>
</sectionSchema>

We set logonMethod=ClearText but as the enum entry was originally ‘3’ this told IIS to actually use the Network Token method (the real value of ‘3’) – which does not allow for the authentication mechanism we require (i.e. Kerberos delegation to a service on another server). Changing the enums to their correct value resolved the issue.

Microsoft probably won’t release a fix for that, so you’ll have to update this schema file on your own.

No related posts.

Categories: IIS Tags: , ,
  1. Win Siu
    March 6th, 2012 at 23:08 | #1

    I am using Windows 2008 R2 SP1, I tried the suggestions above and it is still not working for some reasons. Still getting logon error in event log. According to Windows event log, it is still using Logon Type 3, Failure Reason: Unknown user name or bad password.

  2. March 10th, 2012 at 11:20 | #2

    Do you have logonType set to ClearText?

  3. Win Siu
    March 12th, 2012 at 18:57 | #3

    yes, wonder if it is applicable to Windows Server 2008 R2?

  4. March 12th, 2012 at 18:59 | #4

    I just checked and Microsoft says this exists only in 2008. Thanks for pointing out.

  5. Win Siu
    March 13th, 2012 at 15:28 | #5

    @Jakub “Kocureq” Anderwald
    Thanks for checking it out

  1. No trackbacks yet.