У нас есть несколько серверов AD с установленным доверием леса между ними, поэтому пользователи Windows из разных доменов могут получить доступ к ограниченным ресурсам. Предположим, у нас есть domainA.com и domainB.com, поэтому любой пользователь из домена domainB.com может войти в ресурс на domainA.com. В целях безопасности анонимный доступ к серверам LDAP отключен администраторами.
Теперь нам нужно перечислить всех пользователей со всех серверов LDAP в нашем PHP-коде с помощью клиента OpenLDAP. Ниже приведен код PHP для получения информации обо всех пользователях из domainB.com
define('USER', 'user@domainA.com'); // User from domainA.com here
$ldap = ldap_connect('domainB.com') or die('Bad connection');
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_bind($ldap, USER, PASS) or die('Cannot bind');
Мой скрипт умирает с сообщением «Cannot bind» с ошибкой ldap «49 Invalid credentials». Дополнительная информация от AD:
80090308: LdapErr: DSID-0C0903A9, комментарий: ошибка AcceptSecurityContext, данные 52e, v1db1
Я думаю, что проблема в простом механизме аутентификации, потому что когда я использую аутентификацию согласования GSS в клиенте администратора Ldap с теми же учетными данными для user@domainA.com, все в порядке.
Что я могу сделать для успешного связывания на domainB.com с учетными данными от user@domainA.com?
UPD1 Аутентификация с помощью SASL DIGEST-MD5
ldap_sasl_bind ( $ldap, '', $pass, 'DIGEST-MD5', null, 'user@domainA.com');
Журналы от AD:
The computer attempted to validate the credentials for an account.
Authentication Package: WDigest
Logon Account: user
Source Workstation: DOMAINA
Error Code: 0xc000006a
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: user@domainA.com
Account Domain: domainA.com
Failure Information:
Failure Reason: An Error occured during Logon.
Status: 0xc000006d
Sub Status: 0xc000006d
Process Information:
Caller Process ID: 0x0
Caller Process Name: -
Network Information:
Workstation Name: -
Source Network Address:
Source Port:
Detailed Authentication Information:
Logon Process: WDIGEST
Authentication Package: WDigest
Transited Services: -
Package Name (NTLM only): -
Key Length: 0
This event is generated when a logon request fails. It is generated on the computer where access was attempted.
The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.
The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).
The Process Information fields indicate which account and process on the system requested the logon.
The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.
The authentication information fields provide detailed information about this specific logon request.
- Transited services indicate which intermediate services have participated in this logon request.
- Package name indicates which sub-protocol was used among the NTLM protocols.