简体   繁体   English

DoD CAC身份验证 - 使用.NET C#,Windows Server 2008 R2,IIS 7.5的客户端证书问题

[英]DoD CAC Authentication - Client Certificate Issue with .NET C#, Windows Server 2008 R2, IIS 7.5

We have developed a .NET C# web application for DoD that uses CAC (Common Access Card) as the sole method of authentication. 我们为DoD开发了一个.NET C#Web应用程序,它使用CAC(通用访问卡)作为唯一的身份验证方法。 We have a trusted SSLs on the servers, the application is running in several locations, and everything is working as it should - for the most part. 我们在服务器上有一个受信任的SSL,应用程序在几个位置运行,并且一切正常 - 在大多数情况下。

Issue #1 问题#1

The primary issue is that on some of our internal development servers, when you hit 'log-in' with a valid CAC in the card reader, only one certificate displays and its not from the CAC. 主要问题是,在我们的某些内部开发服务器上,当您使用读卡器中的有效CAC进行“登录”时,只显示一个证书,而不是来自CAC。 Its used to authenticate my work laptop with the network (the "Client Authentication" and "Smart-Card Login" attributes are checked within the Certificates snap-in). 它用于通过网络验证我的工作笔记本电脑(“客户端身份验证”和“智能卡登录”属性在“证书”管理单元中进行检查)。

We have another server on another network where the client certificate authentication works well - it shows the certs from the CAC and does not display the certificate described above. 我们在另一个网络上有另一台服务器,其中客户端证书身份验证运行良好 - 它显示来自CAC的证书,并且不显示上述证书。 I've tried comparing everything I can think of in Windows Server 2008 R2 on these two servers, side-by-side, to see if I could find something that may be different, but they both appear to be default installations of Windows Server 2008 R2. 我已经尝试在这两台服务器上并排比较Windows Server 2008 R2中我能想到的一切,看看我是否能找到可能不同的东西,但它们似乎都是Windows Server 2008的默认安装R2。

The following code is used to read the client certificate: 以下代码用于读取客户端证书:

if (Request.ClientCertificate.IsPresent)
{
    HttpClientCertificate Cert = HttpContext.Current.Request.ClientCertificate;
    //use cert info to check db and create session
}

This file resides within a directory where IIS > SSL Settings > "Require SSL" and "Require Client Certificates" are checked. 此文件位于IIS> SSL设置>“要求SSL”和“需要客户端证书”的目录中。

I don't know if this is a server configuration issue or a coding issue, but I've been working on this for months and cannot find an answer as to why the app can't get the CAC certs only when its hosted on some servers. 我不知道这是服务器配置问题还是编码问题,但是我已经开展了几个月的工作,并且无法找到答案为什么应用程序只有在托管一些CAC证书时才能获得CAC证书服务器。

Issue #2 问题#2

If I access the application on a server where the CAC is read correctly, it pulls copies of all of the certs from all of the CACs used to access the application on that machine, rather than only the certs from the CAC physically in the card reader. 如果我在正确读取CAC的服务器上访问应用程序,它会从用于访问该计算机上的应用程序的所有CAC中提取所有证书的副本,而不是仅从读卡器中的CAC证书中获取证书。

AKO [https://akologin.us.army.mil/] at least filters out the email certs; AKO [https://akologin.us.army.mil/]至少过滤掉电子邮件证书; however, that site is not hosted on a Windows box. 但是,该站点不托管在Windows机器上。

Conclusion 结论

It seems to me that there has to be a better, more in-depth mechanism to access and filter client certificates from the smart card reader, other than the Request.ClientCertificate collection and two checkboxes in IIS. 在我看来,除了Request.ClientCertificate集合和IIS中的两个复选框之外,还必须有一个更好,更深入的机制来访问和过滤来自智能卡读卡器的客户端证书。

I had the same exact issue. 我有同样的问题。 Look for SChannel warnings in the system event logs. 在系统事件日志中查找SChannel警告。

"When asking for client authentication, this server sends a list of trusted certificate authorities to the client. The client uses this list to choose a client certificate that is trusted by the server. Currently, this server trusts so many certificate authorities that the list has grown too long. This list has thus been truncated. The administrator of this machine should review the certificate authorities trusted for client authentication and remove those that do not really need to be trusted." “当请求客户端身份验证时,此服务器会向客户端发送可信证书颁发机构列表。客户端使用此列表选择服务器信任的客户端证书。目前,此服务器信任该列表具有的许多证书颁发机构这个列表因此被截断了。这个机器的管理员应该检查信任的证书颁发机构进行客户端身份验证,并删除那些真正不需要信任的证书。“

There were about a hundred certs in the trusted root certification authorities > certificates. 受信任的根证书颁发机构>证书中有大约一百个证书。 Removed all unneeded certs and did an IISreset as admin and all sites started working again. 删除了所有不需要的证书,并以管理员身份执行了IISreset,所有站点再次开始工作。

Joe, 乔,

For issue #1, here's something to try: Check the Trusted Root Cert Authorities certificates in your working server against your non-working server. 对于问题#1,请尝试以下操作:检查工作服务器中的受信任的根证书颁发机构证书,以防止您的非工作服务器。 It sounds like you may have one or more missing or mismatched server certificates. 听起来您可能有一个或多个丢失或不匹配的服务器证书。 If you have out-dated, mismatched, or missing certificates, you can download them from DISA. 如果您的证书已过时,不匹配或缺失,您可以从DISA下载它们。 The non-working server may not be pulling down the latest cert updates. 非工作服务器可能没有提取最新的证书更新。 We once had a case where there were just too many certificates in the store. 我们曾经有一个案例,商店里的证书太多了。 In that case, we simply deleted old and/or unneeded certificates. 在这种情况下,我们只删除旧的和/或不需要的证书。 Just make sure you EXPORT any certificates you plan to remove BEFORE deleting them...just in case you find out later that you need them after all (that would be 'experience' talking)! 只要确保你导出任何你打算删除的证书,然后再删除它们......以防万一你以后发现你需要它们(这将是'经验'谈话)!

I hope this is helpful and not just something that you've already tried. 我希望这有用,而不仅仅是你已经尝试过的东西。 Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用IIS 7.5,Windows Server 2008 R2和.net Framework 4.5托管网站 - Host Website using IIS 7.5 ,Windows server 2008 R2 and .net framework 4.5 在Windows Server 2008 R2 SP1的IIS 7.5上注册.NET 4.5的安全方法 - Secure way for registering .NET 4.5 on IIS 7.5 on Windows Server 2008 R2 SP1 无法在Windows Server 2008 R2上的IIS7.5中使用net.pipe绑定 - Can't get net.pipe binding working in IIS7.5 on Windows Server 2008 R2 在Windows Server 2008 R2上将.Net Framework与IIS集成 - integrating .Net Framework with IIS on windows server 2008 r2 Windows Server 2008 R2 64位中内置的C#.NET应用程序无法在Windows 7 32位中运行 - C# .NET application built in Windows Server 2008 R2 64bit doesn't run in Windows 7 32bit 如何在Windows Server 2008 R2 Enterpresi和.NET中的Web应用程序上设置TLS证书? - How can I setup TLS certificate on Windows Server 2008 R2 Enterpresi and Web application in .NET? .NET中的客户端证书身份验证(Windows Server) - Client Certificate Authentication in .NET (Windows Server) .NET Core未在Windows 2008 Server R2中运行 - .NET Core is not running in Windows 2008 Server R2 Windows Server 2008 R2上的WCF .NET 4.5 - WCF .NET 4.5 on Windows Server 2008 R2 Windows Server 2008 R2上的.NET Framework 4 RTM - .NET Framework 4 RTM on Windows server 2008 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM