Chúng tôi có một số máy chủ AD với niềm tin rừng đã được thiết lập giữa chúng, vì vậy người dùng Windows từ các miền khác nhau có thể truy cập vào tài nguyên bị hạn chế. Giả sử chúng ta có domainA.com và domainB.com, vì vậy bất kỳ người dùng nào từ miền domainB.com đều có thể đăng nhập vào tài nguyên trên domainA.com. Vì lý do bảo mật, quyền truy cập ẩn danh vào máy chủ LDAP bị vô hiệu hóa bởi quản trị viên.Làm cách nào để liên kết với máy chủ AD bằng PHP với thông tin đăng nhập từ miền đáng tin cậy?
Bây giờ, chúng tôi cần liệt kê tất cả người dùng từ tất cả máy chủ LDAP trong mã PHP của chúng tôi với sự trợ giúp của ứng dụng khách OpenLDAP. Dưới đây là mã PHP để nhận thông tin về tất cả người dùng từ domainB.com
define('USER', '[email protected]'); // 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');
Tập lệnh của tôi chết với thông báo "Không thể ràng buộc" với lỗi ldap "49 Thông tin đăng nhập không hợp lệ". Thông tin thêm từ AD:
80.090.308: LdapErr: DSID-0C0903A9, bình luận: lỗi AcceptSecurityContext, dữ liệu 52E, v1db1
Tôi nghĩ rằng vấn đề là với cơ chế xác thực đơn giản, bởi vì khi tôi sử dụng GSS Negotiate xác thực trong Administrator Ldap khách hàng có cùng thông tin đăng nhập cho [email protected] mọi thứ đều ổn.
Tôi có thể làm gì để liên kết thành công trên domainB.com với thông tin xác thực từ [email protected]?
UPD1 Authentication với SASL DIGEST-MD5
ldap_sasl_bind ($ldap, '', $pass, 'DIGEST-MD5', null, '[email protected]');
Logs từ 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: [email protected] 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.
Tôi cố gắng liên kết với người dùng DN "CN = người dùng, OU = Người dùng đặc biệt, DC = domainA, DC = com" và câu trả lời là "Thông tin đăng nhập không hợp lệ".Global Catalog rất thú vị, nhưng nó cũng không hiệu quả với tôi. – lisachenko
Sử dụng liên kết đơn giản, bạn phải liên kết với người dùng thư mục DomainB! Bạn phải sử dụng SALS để liên kết với người dùng DomainA – JPBlanc
Có hàm ldap_sasl_bind() trong PHP cho ràng buộc SASL, nhưng tôi không thể tìm thấy bất kỳ ví dụ hay nào về cách xác thực Kerberos hoặc NTLM. Bạn có kinh nghiệm với xác thực SASL từ mã PHP không? – lisachenko