本文介绍如何排查尝试生成轻型目录访问协议(LDAP)连接时发生的事件 ID 36884 问题。
问题方案和事件日志
假设出现了下面这种情景:
- 在 LDAPS 连接点上安装证书。
- 证书具有以下特征:
- 主题:ldap.contoso.com
- 使用者备用名称(SAN):ldap.contoso.com
- 在 DNS 服务器中,有以下条目:
- ldap.contoso.com CNAME myldapserver.contoso.com
- myldapserver.contoso.com HOST 10.0.0.1
尝试连接到 LDAPS 连接点时,连接会被删除,并且会收到事件 ID 36884。
Log Name: System
Source: Schannel
Date: <date_and_time>
Event ID: 36884
Task Category: None
Level: Error
Keywords:
User: CONTOSO\<user_name>
Computer: <computer_name>
Description:
The certificate received from the remote server does not contain the expected name. It is therefore not possible to determine whether we are connecting to the correct server. The server name we were expecting is <computer_name>. The TLS connection request has failed. The attached data contains the server certificate.
The SSPI client process is ldp (PID: 5148).
原因
LDAPS 正在寻找与其关联的 myldapserver.contoso.com。 但是,SAN 条目未涵盖 myldapserver.contoso.com。 因此,不会进行服务器名称匹配,并且会删除连接。
如何解决问题
若要解决此问题,请使用以下解决方案之一:
-
使用额外的 SAN(s) 覆盖证书上解析的主机名。
-
在 DNS 中使用 HOST 记录而不是 CNAME 记录。
-
在客户端上配置以下注册表值,以使用 CNAME 进行服务器名称比较。
重要
此部分(或称方法或任务)介绍了修改注册表的步骤。 但是,注册表修改不当可能会出现严重问题。 因此,按以下步骤操作时请务必谨慎。 出于防范目的,请在修改之前备份注册表,以便在出现问题时还原注册表。 有关如何备份和还原注册表的详细信息,请参阅:如何备份和还原 Windows 中的注册表。
- 启动“注册表编辑器”。
- 在注册表中找到以下子项:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP - 创建名为 UseHostnameAsAlias 的新REG_DWORD值,并将该值设置为除零以外的任何值。
- 退出注册表编辑器,然后重启计算机。
配置注册表值后,客户端计算机使用 ldap.contoso.com 进行匹配。 证书 SAN 涵盖它,因此允许连接。