20.4. 自動マウントマップの保存と取得に LDAP を使用するように autofs を設定する
LDAP ディレクトリーに保存されている自動マウントマップを取得するように autofs サービスを設定できます。
前提条件
-
autofsおよびopenldapパッケージがインストールされている。 - セキュアな認証のために Kerberos 対応サービスが実行中である。
手順
-
LDAP アクセスを設定するには、
/etc/openldap/ldap.confファイルを変更します。自動マウントエントリーを見つけるための適切なサーバーおよびベースを反映するために、BASEおよびURIオプションが設定されていることを確認します。 /etc/autofs.confファイルで、自動マウントマップの LDAP スキーマを設定します。デフォルトでは、autofsは頻繁に使用されるスキーマを設定ファイルに指定された順序でチェックします。# # Define the LDAP schema to used for lookups # # If no schema is set autofs will check each of the schemas # below in the order given to try and locate an appropriate # basdn for lookups. If you want to minimize the number of # queries to the server set the values here. # #map_object_class = nisMap #entry_object_class = nisObject #map_attribute = nisMapName #entry_attribute = cn #value_attribute = nisMapEntry # # Other common LDAP naming # #map_object_class = automountMap #entry_object_class = automount #map_attribute = ou #entry_attribute = cn #value_attribute = automountInformation # #map_object_class = automountMap #entry_object_class = automount #map_attribute = automountMapName #entry_attribute = automountKey #value_attribute = automountInformation注記これらの値を明示的に設定して、LDAP クエリーをわずかに減らすこともできます。
/etc/autofs.confファイルに小文字と大文字の両方で属性を書き込むことができます。自動マウント機能マップを LDAP に格納するためにデフォルトされた最新のスキーマが、
rfc2307bisドラフトに記載されています。このスキーマを使用するには、/etc/autofs.confファイルでコメントを解除し、ldap_schemaオプションに適切な値を設定してスキーマを設定します。たとえば、標準以外のスキーマを使用している場合や、デフォルトの動作をオーバーライドする必要がある場合は、/etc/autofs.confファイルで関連するスキーマ属性を指定できます。次の値は、rfc2307bisドラフトなどの一般的に使用されるスキーマ設定に対応しています。default_map_object_class = automountMap default_entry_object_class = automount default_map_attribute = automountMapName default_entry_attribute = automountKey default_value_atrribute = automountInformationautofs は、標準スキーマを自動的に検出します。通常、カスタムまたは混合スキーマ環境の場合にのみこれらの設定を指定する必要があります。使用する場合、スキーマ定義の完全なセットを 1 つだけアクティブにする必要があります。
設定でカスタムスキーマを指定する場合は、スキーマ関連のエントリーの完全なセットが 1 つだけアクティブになっていることを確認してください。競合を避けるため、その他はコメントアウトします。
rfc2307bisスキーマでは、automountKey属性が、古いrfc2307スキーマで使用されていたcn属性に置き換わります。以下は、対応する LDAP データ交換フォーマット (LDIF) 設定の例です。# auto.master, example.com dn: automountMapName=auto.master,dc=example,dc=com objectClass: top objectClass: automountMap automountMapName: auto.master # /home, auto.master, example.com dn: automountMapName=auto.master,dc=example,dc=com objectClass: automount automountKey: /home automountInformation: auto.home # auto.home, example.com dn: automountMapName=auto.home,dc=example,dc=com objectClass: automountMap automountMapName: auto.home # foo, auto.home, example.com dn: automountKey=foo,automountMapName=auto.home,dc=example,dc=com objectClass: automount automountKey: foo automountInformation: filer.example.com:/export/foo # /, auto.home, example.com dn: automountKey=/,automountMapName=auto.home,dc=example,dc=com objectClass: automount automountKey: / automountInformation: filer.example.com:/export/&LDAP サーバーからの認証を許可するには、
/etc/autofs_ldap_auth.confファイルを編集します。-
authrequiredを yes に変更します。 プリンシパルを LDAP サーバー (
host/FQDN@REALM) の Kerberos ホストプリンシパルに設定します。プリンシパル名は、GSS クライアント認証の一部としてディレクトリーへの接続に使用されます。<autofs_ldap_sasl_conf usetls="no" tlsrequired="no" authrequired="yes" authtype="GSSAPI" clientprinc="host/server.example.com@EXAMPLE.COM"/> secret="<ldap password>"/>ホストプリンシパルの詳細は、IdM での正規化された DNS ホスト名の使用 を参照してください。正確なホストプリンシパル情報を取得するために、
klist -kを実行することもできます。
-