1

我需要使用 StartTLS 连接到 AD LDS 实例并从那里获取用户列表。不幸的是,它必须在旧版 C++ 应用程序中完成。我已经在 Windows 2008 R2 机器上安装了测试 AD LDS(在网络服务上运行),看起来我已经正确设置了 SSL,并且可以使用 Apache Directory Studio 从我的客户端机器上访问它(使用 Simple Auth + StartTLS)或 Ldap 管理员。

C++ 中的代码调用

hr = ADsOpenObject(
            szPath, strUserName, strPassword, m_authentication, 
            IID_IADs, (void**)&m_pObject);

https://msdn.microsoft.com/en-us/library/aa772238(v=vs.85).aspx

其中 szPath 是 LDAP://IP:10386/CN=Users,DC=Product,DC=local;strUserName 是 CN=admin,CN=Users,DC=Product,DC=local;m_authentication 是 ADS_AUTHENTICATION_ENUM ( https://msdn.microsoft.com/en-us/library/aa772247%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 )

根据 Microsoft 示例,我正在尝试应该可以工作的 ADS_SECURE_AUTHENTICATION、ADS_USE_ENCRYPTION 和 ADS_USE_SSL 的不同组合。

到目前为止 ADS_USE_ENCRYPTION 和 ADS_USE_SSL 给出了最有希望的错误

00002028: LdapErr: DSID-0C0901FB, comment: The server requires binds to turn on integrity checking if SSL\TLS are not already active on the connection, data 0, v1db1
A more secure authentication method is required for this server.

ADS_SECURE_AUTHENTICATION + ADS_USE_SSL + ADS_USE_ENCRYPTION 给

The user name or password is incorrect.

服务器日志给出了 2 个 Failed Auth 事件:计算机尝试验证帐户的凭据。

Authentication Package: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Logon Account:  CN=admin,CN=Users,DC=Product,DC=local
Source Workstation: <MachineName>
Error Code: 0xc0000064

An account failed to log on.
Subject:
    Security ID:        NULL SID
    Account Name:       -
    Account Domain:     -
    Logon ID:       0x0

Logon Type:         3

Account For Which Logon Failed:
    Security ID:        NULL SID
    Account Name:       CN=admin,CN=Users,DC=Product,DC=local
    Account Domain:     

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xc000006d
    Sub Status:     0xc0000064

Process Information:
    Caller Process ID:  0x0
    Caller Process Name:    -

Network Information:
    Workstation Name:   <MachineName>
    Source Network Address: IP
    Source Port:        PortNum

Detailed Authentication Information:
    Logon Process:      NtLmSsp 
    Authentication Package: NTLM
    Transited Services: -
    Package Name (NTLM only):   -
    Key Length:     0

就像它正在尝试验证用户与本地计算机或与全局 AD,而不是我的测试 AD LDS。

有没有办法强制它对用户和我的测试 AD LDS 进行身份验证?

4

0 回答 0