Show Table of Contents
11.2.7. サービスの設定: autofs
11.2.7.1. 自動マウント、LDAP、SSSD について
自動マウントマップは一般的にフラットファイルで、マップとマウントディレクトリー、ファイルサーバーの関係を定義します。(自動マウントは、Storage Administration Guide で説明されています。)
例えば、
nfs.example.com というファイルサーバーがあったとして、これがディレクトリー pub をホストし、自動マウントが /shares/ ディレクトリーにディレクトリーをマウントするように設定されているとします。すると、マウントする場所は /shares/pub になります。すべてのマウントは auto.master ファイルに一覧表示されており、これはマウントを設定する様々なマウントディレクトリーとファイルを特定します。さらに auto.shares ファイルは、/shares/ ディレクトリーにつながる各ファイルサーバーとマウントディレクトリーを特定します。この関係を図にすると以下のようになります。
auto.master
_________|__________
| |
| |
/shares/ auto.shares
|
|
|
nfs.example.com:pub
すると、すべてのマウントポイントは、
auto.master ファイルと auto.whatever ファイルという少なくとも 2 つのファイルで定義されることになり、これらのファイルは各ローカルの自動マウントプロセスで利用可能である必要があります。
大規模な環境で管理者がこれを管理する方法の一つは、中央 LDAP ディレクトリーに自動マウント設定を保存し、各ローカルシステムをその LDAP ディレクトリーに向けるように設定することです。これにより、アップデートは単一の場所でのみ必要となり、新しいマップはローカルシステムが自動的に認識することになります。
自動マウント - LDAP 設定では、自動マウントファイルは LDAP エントリーとして保存され、その後に必須の自動マウントファイルに変換されます。それで各要素は、LDAP 属性に変換されます。
LDAP エントリーは以下のようになります。
# container entry dn: cn=automount,dc=example,dc=com objectClass: nsContainer objectClass: top cn: automount # master map entry dn: automountMapName=auto.master,cn=automount,dc=example,dc=com objectClass: automountMap objectClass: top automountMapName: auto.master # shares map entry dn: automountMapName=auto.shares,cn=automount,dc=example,dc=com objectClass: automountMap objectClass: top automountMapName: auto.shares # shares mount point dn: automountKey=/shares,automountMapName=auto.master,cn=automount,dc=example,dc=com objectClass: automount objectClass: top automountKey: /shares automountInformation: auto.shares # pub mount point dn: automountKey=pub,automountMapName=auto.shares,cn=automount,dc=example,dc=com objectClass: automount objectClass: top automountKey: pub automountInformation: filer.example.com:/pub description: pub
スキーマ要素は、以下の図ようにマッチします (RFC 2307 スキーマ) 。
auto.masterobjectclass: automountMap filename attribute: automountMapName _______________________|_________________________ | | | |/shares/auto.sharesobjectclass: automount objectclass: automountMap mount point name attribute: automountKey filename attribute: automountMapName map name attribute: automountInformation | | |nfs.example.com:pubobjectclass: automount mount point name attribute: automountKey fileserver attribute: automountInformation
autofs は、これらのスキーマ要素を使用して自動マウント設定を取得します。/etc/sysconfig/autofs ファイルは、自動マウントエントリーに使用される LDAP サーバー、ディレクトリーの位置、スキーマ要素を特定します。
LDAP_URI=ldap://ldap.example.com SEARCH_BASE="cn=automount,dc=example,dc=com" MAP_OBJECT_CLASS="automountMap" ENTRY_OBJECT_CLASS="automount" MAP_ATTRIBUTE="automountMapName" ENTRY_ATTRIBUTE="automountKey" VALUE_ATTRIBUTE="automountInformation"
自動マウント設定を LDAP ディレクトリーではなく、SSSD に向けることができます。すると SSSD は自動マウントが必要とする全情報を保存し、ユーザーがディレクトリーをマウントしようとすると、この情報は SSSD にキャッシュされます。これにより、フェイルオーバーやサービスディレクトリー、タイムアウトなどでの設定が有利になるほか、LDAP サーバーへの接続回数が減ることでパフォーマンスが改善されます。最も重要なのは、SSSD を使用することでマウント情報がすべてキャッシュされるので、LDAP サーバーがオフラインになっても クライアントはディレクトリーを正常にマウントできます。
11.2.7.2. SSSD での autofs サービスの設定
autofsパッケージとlibsss_autofsパッケージがインストールされていることを確認してください。sssd.confファイルを開きます。[root@server ~]# vim /etc/sssd/sssd.conf
autofsサービスを SSSD が管理する一覧に追加します。[sssd] services = nss,pam,
autofs....- 新たな
[autofs]サービス設定セクションを作成します。このセクションは空白のままでかまいません。唯一設定可能なオプションは、ネガティブキャッシュヒットのタイムアウトです。ただし、このセクションは、SSSD がautofsサービスを認識し、デフォルト設定を提供するために必要となります。[autofs]
- 自動マウント情報は、SSSD 設定の設定済み LDAP ドメインから読み取られるので、LDAP ドメインが利用可能である必要があります。追加設定がない場合、自動マウント情報には RFC 2307 スキーマと LDAP 検索ベース (
ldap_search_base) がデフォルト設定となります。これはカスタマイズが可能です。- ディレクトリーのタイプ、
autofs_provider;id_providerの値がデフォルトです。値が なし の場合は、ドメインの autofs を明確に無効とします。 - 検索ベース、
ldap_autofs_search_base - マップエントリーの認識に使用するオブジェクトクラス、
ldap_autofs_map_object_class - マップ名の認識に使用する属性、
ldap_autofs_map_name - マウントポイントエントリーの認識に使用するオブジェクトクラス、
ldap_autofs_entry_object_class - マウントポイント名の認識に使用する属性、
ldap_autofs_entry_key - マウントポイントの新たな設定情報に使用する属性、
ldap_autofs_entry_value
例:[domain/LDAP] ... autofs_provider=ldap ldap_autofs_search_base="cn=automount,dc=example,dc=com" ldap_autofs_map_object_class="automountMap" ldap_autofs_entry_object_class="automount" ldap_autofs_map_name="automountMapName" ldap_autofs_entry_key="automountKey" ldap_autofs_entry_value="automountInformation"
sssd.confファイルを保存し、閉じます。nsswitch.confファイルを編集し、場所をldapからsssに変更することでautofsを設定して、SSSDの自動マウントマップ情報を探します。[root@server ~]# vim /etc/nsswitch.conf automount: files
sss- SSSD を再開始します。
[root@server ~]# service sssd restart

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.