配置IIS客户端证书映射验证

时间:2015-04-07 17:53:50

标签: asp.net authentication iis ssl x509certificate

我正在尝试在IIS 8,Windows Server 2012上配置IIS客户端证书映射。我没有看到配置显示在applicationHost.config中,并且我试图提供的证书不提供为我的浏览器选项。

这是我到目前为止所尝试的内容:

在IIS中,我创建了一个名为“PackageManager”的顶级网站:

enter image description here

SSL设置如下:

enter image description here

身份验证:已启用匿名:

enter image description here

在配置编辑器中, 部分:system.webServer/security/authentication/iisClientCertificateMappingAuthentication 来自:ApplicationHost.config <location path=’PackageManager’> 我设置了以下内容:

enter image description here

我想要manyToOneMappings所以我可以将证书映射到我的服务帐户(域用户):

enter image description here

在这里,我创建了2条规则来匹配GoDaddy证书的主题和发行人CN:

enter image description here

然后我为以上所有内容生成了一个PowerShell脚本:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'PackageManager' -filter "system.webServer/security/authentication/iisClientCertificateMappingAuthentication" -name "enabled" -value "True"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'PackageManager' -filter "system.webServer/security/authentication/iisClientCertificateMappingAuthentication" -name "defaultLogonDomain" -value "CMC"

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'PackageManager' -filter "system.webServer/security/authentication/iisClientCertificateMappingAuthentication/manyToOneMappings" -name "." -value @{name='My 1st Mapping';description='1st User Mapping';userName='DOMAIN\username';password='XXXXXXXXXXX'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'PackageManager' -filter "system.webServer/security/authentication/iisClientCertificateMappingAuthentication/manyToOneMappings/add[@name='My 1st Mapping']/rules" -name "." -value @{certificateField='Subject';certificateSubField='CN';matchCriteria='*.mydomain.com';compareCaseSensitive='False'}

Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'PackageManager' -filter "system.webServer/security/authentication/iisClientCertificateMappingAuthentication/manyToOneMappings/add[@name='My 1st Mapping']/rules" -name "." -value @{certificateField='Issuer';certificateSubField='CN';matchCriteria='Go Daddy Secure Certificate Authority - G2';compareCaseSensitive='False'}

上述所有内容有点奇怪,我在C:\ Windows \ System32 \ inetsrv \ Config \ applicationHost.config中看不到对此配置的任何引用。

浏览此站点时,系统会提示我使用证书,但IE不提供我期望的证书:

enter image description here

这是我一直在试验的自签名证书。

然后我被一个可爱的403击中,所以我陷入了僵局。

我在applicationHost.config中没有显示的配置中我做错了什么,为什么我没有选择提供我的客户端证书(它在我的商店中)?

enter image description here

2 个答案:

答案 0 :(得分:1)

我在Windows Server 2012下遇到了同样的问题,我在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Control\SecurityProviders\Schannel下添加了两个额外的注册表项解决了这个问题:

ClientAuthTrustMode值类型:REG_DWORD,值数据:2

SendTrustedIssuerList值类型:REG_DWORD,值数据:0

有关详细信息,请参阅IIS 8.5 - Mutual certificates authentication fails with error 403.16

答案 1 :(得分:1)

您的GoDaddy证书似乎是服务器身份验证证书(服务器身份验证OID 1.3.6.1.5.5.7.1),IIS可以使用它来实现SSL安全性,并且这个证书应安装在证书&gt;&gt;本地计算机&gt;中。 &GT;个人

对于客户端证书,您需要客户端身份验证OID 1.3.6.1.5.5.7.3.2,并且此证书应安装在证书&gt;&gt;当前用户&gt;&gt;个人身份中。

demo