12.10.2. ユーザーベースのアクセスの定義
userdn キーワードを使用すると、1 つまたは複数の DN に基づいてアクセスを許可または拒否でき、以下の構文を使用します。
userdn comparison_operator "ldap:///distinguished_name || ldap:///distinguished_name || ..."
式の DN を以下のように設定します。
- DN: userdn キーワードでの DN の使用 を参照してください。
- LDAP フィルター: Using the userdn keyword with an LDAP filter を参照してください。
-
anyonealias: Granting anonymous access を参照してください。 -
allエイリアス: 認証済みユーザーへのアクセスの付与 を参照してください。 -
selfエイリアス: Enabling users to access their own entries を参照してください。 -
parentエイリアス: Setting access for child entries of a user を参照してください。
LDAP URL 内でホスト名またはポート番号を指定しないでください。URL は常にローカルサーバーに適用されます。
userdn キーワードでの DN の使用
userdn キーワードを識別名 (DN) に設定して、ACI を一致するエントリーのみに適用します。複数のエントリーを照合するには、DN で * ワイルドカードを使用します。
userdn キーワードを DN とともに使用するには、以下の構文を使用します。
userdn comparison_operator ldap:///distinguished_name
例12.11 userdn キーワードでの DN の使用
uid=admin,ou=People,dc=example,dc=com ユーザーが ou=People,dc=example,dc=com エントリーで他のすべてのユーザーの manager 属性を読み取るようにするには、以下を実行します。
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
dn: ou=People,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="manager") (version 3.0; acl "Allow uid=admin reading manager attribute";
allow (search, read) userdn = "ldap:///uid=admin,ou=People,dc=example,dc=com";)
LDAP フィルターで userdn キーワードの使用
ユーザーへのパーミッションを動的に許可または拒否するには、LDAP フィルターで userdn キーワードを使用します。
userdn comparison_operator "ldap:///distinguished_name??scope?(filter)"
LDAP フィルターは * ワイルドカードをサポートします。
例12.12 LDAP フィルターで userdn キーワードの使用
department 属性が Human Resources に設定されたユーザーを有効にするには、ou=People,dc=example,dc=com エントリーでユーザーの homePostalAddress 属性を更新します。
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
dn: ou=People,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="homePostalAddress") (version 3.0;
acl "Allow HR setting homePostalAddress"; allow (write)
userdn = "ldap:///ou=People,dc=example,dc=com??sub?(department=Human Resources)";)
匿名アクセスの付与
特定の状況では、管理者はディレクトリー内のデータへの匿名アクセスを設定します。匿名アクセスは、以下を指定してディレクトリーにバインドできることを意味します。
- バインド DN およびパスワードなし
- 有効なバインド DN およびパスワード
匿名アクセスを設定するには、bind ルールの userdn キーワードで ldap:///anyone 式を使用します。
userdn comparison_operator "ldap:///anyone"
例12.13 匿名アクセスの付与
認証なしですべてのユーザーが ou=People,dc=example,dc=com エントリーで sn、givenName、および telephoneNumber 属性を読み取りおよび検索できるようにするには、以下を行います。
# ldapmodify -D "cn=Directory Manager" -W -H __ldap://server.example.com -x
dn: ou=People,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="sn" || targetattr="givenName" || targetattr = "telephoneNumber")
(version 3.0; acl "Anonymous read, search for names and phone numbers";
allow (read, search) userdn = "ldap:///anyone")
認証済みユーザーへのアクセスの付与
特定の状況では、管理者は匿名バインドを除き、Directory Server に正常にバインドできるユーザーにパーミッションを付与します。この機能を設定するには、bind ルールの userdn キーワードで ldap:///all 式を使用します。
userdn comparison_operator "ldap:///all"
例12.14 認証済みユーザーへのアクセスの付与
認証されたユーザーが自分自身をメンバーとして ou=example,ou=groups,dc=example,dc=com グループに追加およびグループから削除できるようにするには、以下を実行します。
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
dn: ou=example,ou=Groups,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="member") (version 3.0;
acl "Allow users to add/remove themselves from example group";
allow (selfwrite) userdn = "ldap:///all")
ユーザーが空のエントリーにアクセスできるようにする
ユーザーの独自のエントリーへのアクセスを許可または拒否する ACI を設定するには、bind ルールの userdn キーワードで ldap:///self 式を使用します。
userdn comparison_operator "ldap:///self"
例12.15 ユーザーが空のエントリーにアクセスできるようにする
ou=People,dc=example,dc=com エントリーのユーザーが独自の userPassword 属性を更新できるようにするには、以下を実行します。
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
dn: ou=People,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="userPassword") (version 3.0;
acl "Allow users updating their password";
allow (write) userdn = "ldap:///self")
ユーザーの子エントリーへのアクセス設定
バインド DN がターゲットエントリーの親である場合にのみエントリーへのアクセスを許可または拒否されるように設定するには、bind ルールの userdn キーワードで self:///parent 式を使用します。
userdn comparison_operator "ldap:///parent"
例12.16 ユーザーの子エントリーへのアクセス設定
cn=user,ou=People,dc=example,dc=com ユーザーが独自のサブエントリー (cn=example,cn=user,ou=People,dc=example,dc=com など) の manager 属性を更新できるようにするには、以下を実行します。
# ldapmodify -D "cn=Directory Manager" -W -H ldap://server.example.com -x
dn: cn=user,ou=People,dc=example,dc=com
changetype: modify
add: aci
aci: (targetattr="manager") (version 3.0;
acl "Allow cn=user to update manager attributes";
allow (write) userdn = "ldap:///parent")