2011-07-07 3 views
9

フォレスト間で信頼関係を確立している複数のADサーバーがあるため、異なるドメインのWindowsユーザーは制限されたリソースにアクセスできます。 domainA.comとdomainB.comがあると仮定して、ドメインdomainB.comのどのユーザーもdomainA.comのリソースにログインできます。セキュリティ上の理由から、管理者はLDAPサーバーへの匿名アクセスを無効にします。信頼できるドメインの資格情報を使用してPHPでADサーバーにバインドするにはどうすればよいですか?

OpenLDAPクライアントの助けを借りて、すべてのLDAPサーバーのすべてのユーザーをPHPコードでリストする必要があります。以下は、PHPコードは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'); 

からすべてのユーザーに関する情報を取得することである私のスクリプトがメッセージのLDAPエラーで「49の無効な資格情報を」「バインドできません」と死にます。 ADからの追加情報:
80090308:LdapErr:DSID-0C0903A9、コメント:AcceptSecurityContextエラー、データ部52e、v1db1

私はGSSを使用する場合、LDAP管理者に認証をネゴシエートするので、問題は、単純な認証機構であることを考えます[email protected]と同じ資格情報を持つクライアントはすべて問題ありません。

[email protected]からの資格情報を使用してdomainB.comでバインドを成功させるにはどうすればよいですか? SASL DIGEST-MD5と

UPD1認証ADから

ldap_sasl_bind ($ldap, '', $pass, 'DIGEST-MD5', null, '[email protected]'); 

ログ:

 
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. 

答えて

1

あなたはldap_bindでユーザーをspecifiyするとき、あなたはこのようなあなたのユーザーDNを置くことを試みることができます。

$bind = ldap_bind($resource, 'cn=jpb,cn=users,dc=dom,dc=fr', '***'); 

もう一つは、 アクティブディレクトリフォレストには、「グローバルカタログ(GC)」というディレクトリをサポートする1​​つ以上のドメインコントローラがあります。 GCには、フォレストのすべてのディレクトリのすべてのオブジェクトが含まれています。


編集 あなたはADサーバに接続するために、PHPのLDAPのLIBSとのOpenLDAPを使用してのMoodleを設定するとき、私は、この問題を経験したSASL

$ldap = ldap_connect('domainB.com'); 
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); 
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); 
ldap_sasl_bind ($conn, NULL,"password",'DIGEST-MD5',NULL,'[email protected]',NULL); 
+0

"CN = user、OU = Special Users、DC = domainA、DC = com"というユーザーDNでバインドしようとしましたが、 "無効な資格情報"です。グローバルカタログは興味深いですが、それは私のためにも機能しません。 – lisachenko

+0

単純なバインドを使用すると、DomainBディレクトリのユーザーとバインドする必要があります。 DomainAユーザーとバインドするにはSALSを使用する必要があります – JPBlanc

+0

PHPにSASLバインディング用のldap_sasl_bind()関数がありますが、KerberosまたはNTLM認証の作成方法がわかりません。 PHPコードからSASL認証の経験がありますか? – lisachenko

2

と結合しようとすることができます。解決策は、(実際には一つのことに煮詰めた)、かなり簡単だった、との2つのうちの1つ:

  1. (ユーザ名の後にすなわちノー「@ example.com」)スコープを持たないユーザー名を使用し
  2. 使用DOMAIN \ username

基本的には、正しいと思われるユーザー名の構文を取得していました。フルDN、スコープ付きのユーザー名(電子メールアドレスのように見える)、DOMAIN \ユーザー名、プレーンなユーザー名など、さまざまなADサーバーで動作する4種類のユーザー名があるため、これは特定のAD構成に依存していると思います。

+0

私はここでオプション2が最適だと思います。その形式は、認証用のユーザーとドメインを示すために[具体的には、(http://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v = vs.85).aspx)です。 – Shane

+0

2番目のオプションは、Windows 7で私のために働いていました。ドメインとユーザー名は、「コントロールパネル\ユーザーアカウント\ユーザーアカウント>ユーザーアカウントの管理」(ユーザーアカウントウィンドウのユーザータブ) –

関連する問題