Active Directory

提供:MoodleDocs
移動先:案内検索

作成中です - Mitsuhiro Yoshida 2009年1月29日 (木) 09:58 (CST)

Microsoft社のActive Directory (AD) では、LDAP (Lightweight Directory Access Protocol) のような機能を含む、様々なネットワークディレクトリサービスを提供します。このサービスは、Windows 2000サーバおよびそれ以降のバージョンに実装されています。このページでは、LDAP認証機能を中心に説明します。

ADおよびLDAPのトラブルシューティング

Warning: The PHP LDAP module does not seem to be present. Please ensure it is installed and enabled.

通常、これはメインのldap dllまたはサポートされているdllのひとつが見つからないことを意味します。 メインのdllから始めてみましょう。 http://(moodleserver)/admin/phpinfo.phpを閲覧して、どのphp.iniを使用するか指定する「Configuration File (php.ini) Path 」フィールドを確認した後、php.iniをエディタで開いてください。「extension=php_ldap.dll」の行を見つけて、先頭にセミコロンある場合、セミコロンを削除してください。このセミコロンにより、モジュールの読み込みは停止されてしまいます! あなたのこのファイルを開いている間に、「extension_dir」を探して、どのフォルダが設定されているかメモしてください。そのフォルダを開いて、そこにphp_ldap.dllがあるかどうか確認してください。 まだ、問題が解決しない場合、サポートされているdllがありませんが、あなたはどのdllがないのか伝えられていません。どのdllがないのか確認するには、コマンドプロンプトを開いてPHPディレクトリに移動した後、コマンド「php -m」を実行してください。あなたは、何らかのエラーメッセージを確認することができるはずです。スマートではありませんが、あなたは少なくともエラーに関する情報を取得することができます! 一覧表示されているDLLを見つけて、PHPディレクトリにコピーしてください。そして、apache/httpサービスをリスタートしてください。再度、「php -m」コマンドを実行するとエラーが表示されないはずです。また、Moodle内のメッセージにもエラーが表示されません。

すべてのLDAPサーバにLDAPモジュールから接続できません

LDAP-module cannot connect any LDAP servers: 
Server: 'ldap://my.ldap.server/' 
Connection: 'Resource id #26' Bind result: 

このメッセージが表示される場合、あなたは正しくないバインドユーザ情報でログインを試みているか、ユーザアカウントにAcrive Directoryで十分なパーミッションがないことが考えられます。この問題を解決する最良の方法は、ldp.exeを使用して、成功するまでバインドをテストすることです。ldp.exeのインストールに関するインストラクションは下記にあります。 プログラムを開いて、ADに接続します。サーバ名を入力して、接続メニューからバインドを選択してください。あなたが正しいと思う詳細情報を入力すると、恐らくエラーメッセージが返されると思われます。アカウントの特権を調整するか、別のアカウントを使用して「Authenticated as」メッセージが表示されるまで試してください。あなたのアカウントがADのバインドに使用することができると確信できるようになった場合、ユーザ名のDNが正しいかどうか確認してください。あなたがバインドに使用するユーザが見つかるまで、左側のツリーを広げてください。アイテムの上で右クリックして、DNをコピーしてください。Moodleのユーザ認証ページに移動して、値をldap_bind_dnフィールドに貼り付けてください。パスワードを追加してください。これで、あなたのユーザを正常にバインドできるようになります。

コンテクストおよびクリエータに関して、正しいCNを取得する

ADに精通していない人にとって、これは非常に難解であり、精通している人にとって、それほど簡単だというわけではありません。再び、ldp.exeはあなたの友人であると言えます。ldp.exeのインストールに関するインストラクションは下記にあります。 あなたがバインドに使用するユーザが見つかるまで、左側のツリーを広げてください。アイテムの上で右クリックして、DNをコピーしてください。Moodleのユーザ認証ページに戻って、値をldap_contextsまたはldap_creatorsに貼り付けてください。

正しいuser_attributeを取得する

デフォルトで、認証のためMoodleはアカウントのcn (フルネーム) を使用します。しかし、多くのネットワークでは、推測することが非常に簡単なため、完全な姓を使用しません。また、あなたは簡単に同じアカウント名のユーザを2名持つことができてしまいます。このケースがあなたに当てはまる場合、あなたはログインIDに関して、別のフィールドをMoodleに伝える必要があります。 ldp.exeでは、あなた自身でユーザアカウントを探せるよう、左側にツリーが表示されます。ツリーのアイテムをダブルクリックすることで、ユーザアカウント詳細が画面の右側に表示されます。あなたがログインIDを探すまで、一覧表示されているアイテムを閲覧してください。私にとって、また多くの人にとって、sAMAccountNameになると思います。このアカウント名をコピーして、Moodleユーザ認証ページのldap_user_attributeに貼り付けてください。 ldp.exeのインストールに関するインストラクションは下記にあります。

ldp.exeサーバツールをインストールする

ほとんどのバージョンのWindowsサーバでは、ldp.exeは一部のサーバツールとして提供されます。あなたのWindowsサーバインストールディスクを探して、その中でSupport\Toolsという名称のフォルダを探してください。そのフォルダの中にサーバツールのインストールを実行できるSupTools.msiがあります。インストールの実行後、あなたはProgram Filesフォルダ配下に、ldp.exeが入ったSupport Toolsというフォルダを持ちます。Windows XP Support Toolsでも使用でるldp.exeはMicrosoftのここからダウンロードすることができます。代わりに単一のldp.exeは、ここからダウンロードすることができます。

Active Directory設定例

以下、Active Directoryの設定例です。上記詳細のように、あなたのローカルActive Directory設定に基づき、それぞれ値は異なります。しかし、ほとんどのケースに対して、有効なスターティングポイントを提供します。

ldap_host_url = ldap://ads.example.com
ldap_version = 3
ldap_preventpassindb = yes
ldap_bind_dn = bind-user@example.com
ldap_bind_pw = bind-password
ldap_user_type = MS ActiveDirectory
ldap_contexts = ou=moodleusers,dc=example,dc=com
ldap_user_attribute = sAMAccountName


ldap_bind_dnの値は、メインのインストラクションで表示されている「CN=bin-user,CN=Users,DC=example,DC=com」フォーマットまたはこの例で表示されている「bind-user@example.com」フォーマットのどちらか適用することができます。

グローバルカタログ

現在、Moodleは複数ドメインコントローラのみ限定サポートしています。特に、同一の情報セットを含むLDAPサーバを想定しています。あなたのユーザが複数のドメインに登録されている場合、問題が生じてしまいます。One solution when working with MS-AD is to use the Global Catalog. The Global Catalog is designed to be a read-only, partial representation of an entire MS-AD forest, designed for searching the entire directory when the domain of the required object is not known.

グローバルカタログを有効化する

The Global Catalog is available on Windows 2000 and Windows 2003 Active Directory servers. To enable, open the ‘Active Directory Sites and Services’ MMC (Microsoft Management Console) snap-in. Extend ‘Sites’ and then the name of the Site containing the active directory forest you wish to use. Expand the server you wish to enable the Global Catalog on, right click ‘NTDS settings’ and select the ‘Properties’ tab. To enable, simply click the ‘Global Catalog’ checkbox. Under a Windows 2000 server it is necessary to restart the server (although it won’t prompt you to); under Windows 2003 server it is not necessary to restart the server. In either case you will generally have to wait for the AD forest to replicate before the Global Catalog offers a representation of the entire AD forest. Changes made in Active Directory will also be subject to a short delay due to the latency involved with replication. If your AD servers are firewalled port 3268 will need to be opened for Global Catalog servers. If your organisation uses Microsoft Exchange then it its highly likely that at least one Domain Controller will already have Global Catalog enabled – Exchange 2000 and 2003 rely on the Global Catalog for address information, users also access the Global Catalog when using the GAL (Global Address List)


子ドメイン

If your organisation has a main domain example.org, staff and students are contained in two child domains staff.example.org and students.example.org. The 3 domains (example.org, staff.example.org and students.example.org) each have a domain controller (dc01, dc02 and dc03 respectively.) Each domain controller contains a full, writable, representation of only the objects that belong to its domain. However, assuming that the Global Catalog has been enabled (see below) on one of the domain controllers (for example dc01) a query to the Global Catalog would reveal matching objects from all three domains. The Global Catalog is automatically maintained through replication across the active directory forest, it can also be enabled on multiple servers (if, for example, you need redundancy / load balancing.)

To make use of this in Moodle to allow logins from multiple domains is simple. The Global Catalog runs on port 3268 as opposed to 389 for standard LDAP queries. As a result, still assuming the Global Catalog is running on dc01, the 'ldap_host_url' would be ldap://dc01.example.org:3268. The rest of the settings are the same as for other MS-AS Auth setups.

You should use the 'ldap_contexts' setting to indicate the locations of individuals you wish to grant access. To extend the example above a little: In the example.org domain users are all in the 'Users' OU, in the staff.example.org domain users are in two OUs at the root of the domain, 'Support Staff' and 'Teaching Staff' , and in the students.example.org domain students are in an OU indicating the year that they enrolled, all of which are under the 'Students' OU. As a result our 'ldap_contexts' setting may look a little like this: 'OU=Users,DC=example,DC=org; OU=Support Staff,DC=staff,DC=example,DC=org; OU=Teaching Staff,DC=staff,DC=example,DC=org; OU=Students,DC=students,DC=example,DC=org.' The 'ldap_search_sub' option should be set to 'Yes' to allow moodle to search within the child OUs.

Its worth noting that the Global Catalog only contains a partial representation of the attributes of each object, as defined in the Partial Attribute Set supplied by Microsoft. However common information likely to be of use to a general Moodle installation (Forename, Surname, Email Address, sAMAccountName etc) is included in the set. For specific needs the schema can be altered to remove or add various attributes.

In most cases the Global Catalog is read-only, update queries must be made over the standard LDAP ports to the domain controller that holds the object in question (in our example, updating a student's details would require an LDAP query to the students.example.org domain controller - dc03, it would not be possible to update details by querying the Global Catalog.) The exception to this would be in an environment where there is only a single domain in the active directory forest; in this case the Global Catalog holds a writable full set of attributes for each object in the domain. However, for the purposes of Moodle authorisation, there would be no need to use the Global Catalog in this case.

Active Directory + Moodle 1.8

Modle 1.8において、Active Directoryアクセスが必要な場合、PHP LDAPオプションに問題があります。

Active Directory認証のLAPMプラットフォームでMoodleを使用する場合、エラーが発生します。

詳細は、このバグレポート[https://tracker.moodle.org/browse/MDL-10921 MDL-10921]を確認するか、この投稿 http://moodle.org/mod/forum/discuss.php?d=78316 をご覧ください。

MSアクティブディレクトリ + SSL

認証局 (Certificate Authority) がインストールされていない場合、まず次のようにインストールしてください:

  1. スタート -> コントロールパネル -> プログラムの追加と削除 をクリックする。
  2. 「'Windowsコンポーネントの追加と削除」をクリックして、インターネット認証サービス を選択する。
  3. インターネット認証サービス のインストール手順に従う。エンタープライズレベルの選択をお勧めします。

WindowsインストールCDの\Support\toolsディレクトリから suptools.msi をインストールすることで、SSLが有効にされていることを確認してください。サポートツールをインストールした後に:

  1. スタート -> ファイル名を指定して実行 を選択して、入力フィールドに ldp と入力してください。
  2. ldapウィンドウから 接続 -> 接続 を選択して、有効なホスト名およびポート番号 636 を入力してください。また、SSLチェックボックスをチェックしてください。

正常に設定された場合、接続に関する情報が表示されます。

クライアント再度に関する設定の詳細は、クライアントサイド (Moodleサーバ) でLDAPSを有効にするをご覧ください。

関連情報