使用互联网信息服务(IIS)进行 TLS 客户端验证¶
Compatible Nitrokeys |
|||||||
---|---|---|---|---|---|---|---|
✓ active |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
⨯ inactive |
本指南介绍 Windows Internet 信息服务 (IIS) 对 TLS 客户端身份验证的配置,可将用户映射到本地用户账户。
它以 IIS 的*默认网站* 为例显示了配置。该配置也可用于其他网站,包括或不包括默认网站。
Prerequisits¶
Nitrokey 3 with PIV client authentication certificate.
视窗服务器(网络服务器)
DNS record
DNS 记录的 TLS 证书。客户端计算机必须信任该 TLS 证书。
安装¶
Open the Server Manager.
In the menubar on the top click Manage → Add Roles and Features.
按照向导步骤**服务器角色** 。
从可用角色列表中选择角色**Web Server (IIS)** 。
按照向导进入**Web Server Role (IIS)** 下的**Roles Services** 步骤。
从角色服务列表中选择**Web Server → 安全 → IIS 客户端证书映射身份验证** 。
按照向导进行安装。必须在安装完成后才能开始配置。
配置¶
打开*Internet Information Services (IIS) Manager* (
InetMgr.exe
)。在左侧的**Connections** 树状视图中选择并展开要配置的网络服务器。
从中间窗格打开**配置编辑器** 。打开``system.webServer/security/authentication/iisClientCertificateMappingAuthentication`` 部分,点击右侧**Actions** 窗格中的**Unlock Section** 解除锁定。
展开网络服务器下的**站点** ,选择要配置的站点。
在**操作** 右侧窗格中单击**绑定...** 。
单击**Add...** ,弹出绑定编辑器。将类型设为**https** ,并根据 DNS 记录和 TLS 证书的主题替代名称 (SAN) 属性设置主机名。激活复选框**Disable TLS 1.3 over TCP** 。在**SSL 证书** 字段中选择相应证书。点击**OK** 确认配置。
小技巧
要了解禁用 TLS 1.3 的要求以及如何在启用 TLS 1.3 后使用它的配置说明,请参阅`Microsoft 支持博文<https://techcommunity.microsoft.com/blog/iis-support-blog/windows-server-2022-iis-web-site-tls-1-3-does-not-work-with-client-certificate-a/4129738>`__。
从中间窗格打开**SSL 设置** 。激活**Require SSL** 复选框,并将**Client certificates** 下的单选按钮设置为**Require** 。单击右侧**操作** 窗格中的**应用** 确认配置。
从中间窗格打开**Authentication** 。确保停用网站的所有其他身份验证方法。IIS 客户证书映射身份验证 将永远不会在此列表中显示。返回网站根目录。
重要
如果启用了任何其他类型的身份验证,客户端证书映射将不起作用。
从中间窗格打开**配置编辑器** 。从``ApplicationHost.config <location path='Default web site'/>`` 打开``system.webServer/security/authentication/iisClientCertificateMappingAuthentication`` 部分。将``enabled`` 键设置为``True``,并确保启用``manyToOneCertificateMappingsEnabled`` 和``oneToOneCertificateMappingsEnabled`` 中的一个或两个键。
用户映射必须写入键``manyToOneMappings`` 或``oneToOneMappings``。使用哪个键取决于要使用的映射。有关映射的信息和更详细的配置说明,请访问`Microsoft Learn<https://learn.microsoft.com/en-us/iis/configuration/system.webserver/security/authentication/iisclientcertificatemappingauthentication/>`__。
要更改键值,请单击值文本字段末尾的**...** 按钮。这将打开*Collection Editor* 。要创建新映射,请单击右侧**操作** 窗格中的**添加** 。
多对一映射
填写下表所示字段。
Key
价值
enabled
True
name
<name-for-the-collection>
password
<user-password>
permissionMode
Allow
userName
<username>
name
字段用作集合的标识符,userName
和``password`` 要求提供要映射的本地用户的用户名和密码。rules
字段必须包含允许或拒绝证书的说明。要更改规则密钥,请单击值文本字段末尾的**...** 按钮。这将打开*Collection Editor* 的新窗口。要创建新规则,请单击右侧**操作** 窗格中的**添加** 。填写下表所示字段。
Key
价值
certificateField
Subject
certificateSubField
O
compareCaseSensitive
True
matchCriteria
<criteria-value-of-o-field-in-certificate-subject>
关闭*Collection Editor* 窗口。
一对一映射
填写下表中的字段。
Key
价值
certificate
<base64-encoded-certificate>
enabled
True
password
<user-password>
userName
<username>
certificate
字段的 Base64 编码证书可通过``硝酸盐<../../../../software/nitropy/index.html>`__ 和``nitropy nk3 piv --experimental read-certificate --format PEM --key 9A`` 命令从硝基获取。userName
和``password`` 字段需要输入要映射的本地用户的用户名和密码。关闭*Collection Editor* 窗口。
在**操作** 右侧窗格中点击**Apply** 确认配置。
现在,网站已配置为使用本地用户账户映射进行 TLS 客户端身份验证。