Documentation

23. LDAP 認証の設定

注釈

If the LDAP server you want to connect to has a certificate that is self-signed or signed by a corporate internal certificate authority (CA), the CA certificate must be added to the system's trusted CAs. Otherwise, connection to the LDAP server will result in an error that the certificate issuer is not recognized. Refer to Knowledge Base article, How Do I Import CA Certificate (openldap, AD, IDM, FreeIPA) Required for LDAPS Integration?. If prompted, use your Red Hat customer credentials to login.

管理者は、コントローラーユーザーのアカウント認証情報のソースとして LDAP を使用します。ユーザー認証は提供されますが、ユーザーのパーミッションや認証情報は同期されません。組織のメンバーシップ (および組織の管理者) やチームのメンバーシップは同期できます。

上記のように設定された場合は、LDAP のユーザー名およびパスワードでログインすると自動的にコントローラーのアカウントが作成され、各ユーザーは通常のユーザーまたは組織の管理者として組織に所属します。

LDAP ログインで作成されたユーザーは、ユーザー名、姓名を変更できず、ローカルのパスワードも設定できません。これは、さらにカスタマイズして他のフィールド名の編集を制限することができます。

コントローラーの LDAP 統合を設定するには、以下を行います。

  1. まず、LDAP 構造全体の読み取り権限があるユーザーを LDAP に作成します。

  2. LDAP サーバーにクエリーを正常に実行できるかどうかをテストするには、ldapsearch コマンドを実行します。このコマンドツールは、コントローラーシステムのコマンドライン、他の Linux、OSX システムにインストールすることができます。以下のコマンドを使用して、ldap サーバーにクエリーを実行してください。josie および Josie4Cloud は、お使いの設定で機能する属性に置き換えてください。

ldapsearch -x  -H ldap://win -D "CN=josie,CN=Users,DC=website,DC=com" -b "dc=website,dc=com" -w Josie4Cloud

ここでは、CN=josie,CN=users,DC=website,DC=com は接続ユーザーの識別名です。

注釈

ldapsearch ユーティリティーは、automation controller に自動的にインストールされませんが、openldap-clients パッケージからインストールできます。

  1. automation controller ユーザーインターフェースの左側のナビゲーションから 設定 をクリックし、認証オプションの一覧から LDAP 設定 を選択します。

Multiple LDAP configurations are not needed per LDAP server, but you can configure multiple LDAP servers from this page, otherwise, leave the server at Default:

_images/configure-tower-auth-ldap-servers.png

同等の API エンドポイントにより、AUTH_LDAP_* が表示され、AUTH_LDAP_1_*AUTH_LDAP_2_*、... AUTH_LDAP_5_* と繰り返し表示し、サーバーの割り当てを示します。

  1. To enter or modify the LDAP server address to connect to, click Edit and enter in the LDAP Server URI field using the same format as the one prepopulated in the text field:

_images/configure-tower-auth-ldap-server-uri.png

注釈

Multiple LDAP servers may be specified by separating each with spaces or commas. Click the help icon to comply with proper syntax and rules.

  1. LDAP バインドパスワード テキストフィールドにバインドに使用するユーザーのパスワードを入力します。以下の例では、パスワードは 'passme' です。

_images/configure-tower-auth-ldap-bind-pwd.png
  1. LDAP グループタイプ のドロップダウンメニュー一覧からグループタイプをクリックして選択します。

LDAP グループタイプには以下が含まれます。

  • PosixGroupType

  • GroupOfNamesType

  • GroupOfUniqueNamesType

  • ActiveDirectoryGroupType

  • OrganizationalRoleGroupType

  • MemberDNGroupType

  • NISGroupType

  • NestedGroupOfNamesType

  • NestedGroupOfUniqueNamesType

  • NestedActiveDirectoryGroupType

  • NestedOrganizationalRoleGroupType

  • NestedMemberDNGroupType

  • PosixUIDGroupType

The LDAP Group Types that are supported by the controller leverage the underlying django-auth-ldap library. To specify the parameters for the selected group type, see Step 15 below.

  1. LDAP Start TLS はデフォルトでは無効になっています。LDAP 接続で SSL を使用せずに TLS を有効化するには、クリックして ON に切り替えます。

_images/configure-tower-auth-ldap-start-tls.png
  1. LDAP バインド DN テキストフィールドに識別名を入力して、コントローラーが LDAP サーバーへの接続 (バインド) に使用するユーザーを指定します。以下では例として CN=josie,CN=users,DC=website,DC=com を使用します。

_images/configure-tower-auth-ldap-bind-dn.png
  1. 名前が sAMAccountName キーに格納されている場合に、LDAP ユーザー DN テンプレート には (sAMAccountName=%(user)s) のデータが投入されます。Active Directory はユーザー名を sAMAccountName に保存します。同様に、OpenLDAP の場合は、キーは uid なのでこの行は (uid=%(user)s) となります。

  2. Enter the group distinguish name to allow users within that group to access the controller in the LDAP Require Group field, using the same format as the one shown in the text field, CN=controller Users,OU=Users,DC=website,DC=com.

_images/configure-tower-auth-ldap-req-group.png
  1. LDAP 拒否グループ フィールドでグループの識別名を入力して、対象のグループ内のユーザーがコントローラーにアクセスできないようにします。この際、テキストフィールドに表示されている形式と同じものを使用します。この例では、このフィールドには何も入力しません。

  2. Enter where to search for users while authenticating in the LDAP User Search field using the same format as the one shown in the text field. In this example, use:

[
"OU=Users,DC=website,DC=com",
"SCOPE_SUBTREE",
"(cn=%(user)s)"
]

最初の行では LDAP ツリーの中でユーザーを検索する場所を指定します。上記の例では、DC=website,DC=com から開始して再帰的にユーザーの検索が実行されます。

2 行目は、ユーザーを検索する範囲を指定します。

  • SCOPE_BASE: この値は、基本 DN でエントリーのみを検索して、このエントリーだけが返されるように指定する時に使用します。

  • SCOPE_ONELEVEL: この値は、基本 DN の 1 つ下のレベルにあるエントリーをすべて検索するように指定する時に使用します。ここでは、基本 DN や、基本 DN 配下のこのレベルよりも下のレベルにあるエントリーは検索には含めません。

  • SCOPE_SUBTREE: この値は、指定した基本 DN も含めて、全レベルの全エントリーを検索するように指定する際に使用します。

3 行目は、ユーザー名を保存するキー名を指定します。

_images/configure-tower-authen-ldap-user-search.png

注釈

複数の検索クエリーの場合の正しい構文は以下のとおりです。

[
  [
  "OU=Users,DC=northamerica,DC=acme,DC=com",
  "SCOPE_SUBTREE",
  "(sAMAccountName=%(user)s)"
  ],
  [
  "OU=Users,DC=apac,DC=corp,DC=com",
  "SCOPE_SUBTREE",
  "(sAMAccountName=%(user)s)"
  ],
  [
  "OU=Users,DC=emea,DC=corp,DC=com",
  "SCOPE_SUBTREE",
  "(sAMAccountName=%(user)s)"
  ]
]
  1. LDAP グループ検索 のテキストフィールドで、検索するグループ、検索方法を指定します。この例では、以下を使用します。

 [
"dc=example,dc=com",
"SCOPE_SUBTREE",
"(objectClass=group)"
 ]
  • 最初の行は、グループを検索すべき基本 DN を指定します。

  • 2 行目は、ユーザーディレクティブと同じで、範囲を指定します。

  • 3 行目は、使用する LDAP において、グループオブジェクトの objectclass は何であるかを指定します。

_images/configure-tower-authen-ldap-group-search.png
  1. LDAP ユーザー属性マップ テキストフィールドに、ユーザー属性を入力します。この例では以下を使用します。

{
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}

上記の例は、sn のキーから名 (last name) でユーザーを取得しています。同じ LDAP クエリーをそのユーザーに使用して、どのキーに保存されているのかを確認することができます。

_images/configure-tower-auth-ldap-user-attrb-map.png
  1. Depending on the selected LDAP Group Type, different parameters are available in the LDAP Group Type Parameters field to account for this. LDAP_GROUP_TYPE_PARAMS is a dictionary, which will be converted by the controller to kwargs and passed to the LDAP Group Type class selected. There are two common parameters used by any of the LDAP Group Type; name_attr and member_attr. Where name_attr defaults to cn and member_attr defaults to member:

{"name_attr": "cn", "member_attr": "member"}

特定の LDAP グループタイプが必要とするパラメーターを判断するには、「django_auth_ldap 」ドキュメントのクラス init パラメーターの部分を参照してください。

  1. LDAP ユーザーフラグ (グループ別) テキストフィールドでユーザープロファイルフラグを入力します。この例では、以下の構文を使用して LDAP ユーザーを "Superusers" および "Auditors" に設定します。

{
"is_superuser": "cn=superusers,ou=groups,dc=website,dc=com",
"is_system_auditor": "cn=auditors,ou=groups,dc=website,dc=com"
}

上記の例では、プロファイルの superuser または auditor としてフラグがつけられたユーザーを取得します。

_images/configure-tower-auth-ldap-user-flags.png
  1. マッピングフィールドの入力に関する情報は、「LDAP 組織およびチームマッピング」を参照してください。

_images/configure-ldap-orgs-teams-mapping.png
  1. 完了したら 保存 をクリックします。

このフォームで入力したこれらの値を使用して、LDAP で正常に認証を行うことができます。

注釈

The controller does not actively sync users, but they are created during their initial login. To improve performance associated with LDAP authentication, see LDAP authentication performance tips at the end of this chapter.

23.1. LDAP 組織およびチームマッピング

You can control which users are placed into which controller organizations based on LDAP attributes (mapping out between your organization admins/users and LDAP groups).

キーは組織名です。組織が存在しない場合には、作成されます。値は、各組織のメンバーシップのオプションを定義するディクショナリーです。各組織に対して、組織のユーザーとなるグループ、そして組織を管理するグループを自動的に指定することができます。

admins: None、True/False、文字列または文字列のリスト/タプル
  • None の場合は、組織の管理者は LDAP の値をもとに更新されません。

  • True の場合は、LDAP の全ユーザーが自動的に組織の管理者として追加されます。

  • If False, no LDAP users will be automatically added as admins of the organization.

  • 文字列または文字列のリストの場合は、指定したグループに一致する場合に、組織に追加されるグループ DN を指定します。

remove_admins: True/False。デフォルト値は False です。
  • True の場合は、指定のグループのメンバーでないユーザーは、組織の管理者リストから削除されます。

users: None、True/False、文字列または文字列のリスト/タプル。admins と同じルールが適用されます。

remove_users: True/False。デフォルト値は False で、remove_admins と同じルールが適用されます。

{
"LDAP Organization": {
  "admins": "cn=engineering_admins,ou=groups,dc=example,dc=com",
  "remove_admins": false,
  "users": [
    "cn=engineering,ou=groups,dc=example,dc=com",
    "cn=sales,ou=groups,dc=example,dc=com",
    "cn=it,ou=groups,dc=example,dc=com"
  ],
  "remove_users": false
},
"LDAP Organization 2": {
  "admins": [
    "cn=Administrators,cn=Builtin,dc=example,dc=com"
  ],
  "remove_admins": false,
  "users": true,
  "remove_users": false
}
}

チームメンバー (ユーザー) と LDAP グループ間のマッピングです。キーはチーム名です (存在しない場合に作成されます)。値は、各チームのメンバーシップに関するオプションのディクショナリーとなります。各値には以下のパラメーターを含めることができます。

organization: 文字列。チームが所属する組織名。

チームは、組織とチームの組み合わせが存在しない場合には作成されます。組織が存在しない場合には、先に作成されます。

users: None、True/False、文字列または文字列のリスト/タプル

  • None の場合には、チームメンバーは更新されません。

  • True/False の場合には、全 LDAP ユーザーがチームメンバーとして追加/削除されます。

  • 文字列または文字列リストの場合は、グループ DN を指定します。ユーザーがこれらのグループのメンバーの場合には、チームメンバーとして追加されます。

remove: True/False。デフォルト値は False です。True の場合は、対象のグループのメンバーでないユーザーは、そのチームから削除されます。

{
"LDAP Engineering": {
  "organization": "LDAP Organization",
  "users": "cn=engineering,ou=groups,dc=example,dc=com",
  "remove": true
},
"LDAP IT": {
  "organization": "LDAP Organization",
  "users": "cn=it,ou=groups,dc=example,dc=com",
  "remove": true
},
"LDAP Sales": {
  "organization": "LDAP Organization",
  "users": "cn=sales,ou=groups,dc=example,dc=com",
  "remove": true
}
}

23.2. LDAP のロギングの有効化

LDAP のロギングを有効化するには、オプション設定ウィンドウでレベルを DEBUG に設定する必要があります。

  1. 左側のナビゲーションペインから 設定 をクリックし、オプションのシステム一覧から ロギング設定 を選択します。

  2. 編集 をクリックします。

  3. ログアグリゲーターレベルのしきい値 フィールドを Debug に設定します。

_images/settings-system-logging-debug.png
  1. 保存 をクリックして変更を保存します。

23.3. 参照

Active Directory は、クエリーしたオブジェクトがデータベースで利用できない場合のために、「参照」を使用します。これは、django LDAP クライアントで多くの場合に正しく機能しないので、参照を無効にすると回避できます。/etc/tower/conf.d/custom.py ファイルに以下の行を追加して、LDAP の参照を無効にしてください。

AUTH_LDAP_GLOBAL_OPTIONS = {
    ldap.OPT_REFERRALS: False,
}

23.4. LDAP authentication performance tips

When an LDAP user authenticates, by default, all user-related attributes will be updated in the database on each log in. In some environments, this operation can be skipped due to performance issues. To avoid it, you can disable the option AUTH_LDAP_ALWAYS_UPDATE_USER. Refer to the Knowledge Base Article 5823061 for its configuration and usage instructions. Please note that new users will still be created and get their attributes pushed to the database on their first login.

警告

With this option set to False, no changes to LDAP user's attributes will be updated. Attributes will only be updated the first time the user is created.