Chapter 119. Using automount in IdM
Automount is a way to manage, organize, and access directories across multiple systems. Automount automatically mounts a directory whenever access to it is requested. This works well within an Identity Management (IdM) domain as it allows you to share directories on clients within the domain easily.
The example uses the following scenario:
- nfs-server.idm.example.com is the fully-qualified domain name (FQDN) of a Network File System (NFS) server.
For the sake of simplicity, nfs-server.idm.example.com is an IdM client that provides the maps for the raleigh automount location.
NoteAn automount location is a unique set of NFS maps. Ideally, these maps are all located in the same geographical region so that, for example, the clients can benefit from fast connections, but this is not mandatory.
- The NFS server exports the /exports/project directory as read-write.
- Any IdM user belonging to the developers group can access the contents of the exported directory as /devel/project/ on any IdM client that uses the raleigh automount location.
- idm-client.idm.example.com is an IdM client that uses the raleigh automount location.
If you want to use a Samba server instead of an NFS server to provide the shares for IdM clients, see the Red Hat Knowledgebase solution How do I configure kerberized CIFS mounts with Autofs in an IPA environment?.
119.1. Autofs and automount in IdM Copiar enlaceEnlace copiado en el portapapeles!
The autofs service automates the mounting of directories, as needed, by directing the automount daemon to mount directories when they are accessed. In addition, after a period of inactivity, autofs directs automount to unmount auto-mounted directories. Unlike static mounting, on-demand mounting saves system resources.
- Automount maps
On a system that utilizes
autofs, theautomountconfiguration is stored in several different files. The primaryautomountconfiguration file is/etc/auto.master, which contains the master mapping ofautomountmount points, and their associated resources, on a system. This mapping is known as automount maps.The
/etc/auto.masterconfiguration file contains the master map. It can contain references to other maps. These maps can either be direct or indirect. Direct maps use absolute path names for their mount points, while indirect maps use relative path names.- Automount configuration in IdM
While
automounttypically retrieves its map data from the local/etc/auto.masterand associated files, it can also retrieve map data from other sources. One common source is an LDAP server. In the context of Identity Management (IdM), this is a 389 Directory Server.If a system that uses
autofsis a client in an IdM domain, theautomountconfiguration is not stored in local configuration files. Instead, theautofsconfiguration, such as maps, locations, and keys, is stored as LDAP entries in the IdM directory. For example, for theidm.example.comIdM domain, the default master map is stored as follows:dn: automountmapname=auto.master,cn=default,cn=automount,dc=idm,dc=example,dc=com objectClass: automountMap objectClass: top automountMapName: auto.master
dn: automountmapname=auto.master,cn=default,cn=automount,dc=idm,dc=example,dc=com objectClass: automountMap objectClass: top automountMapName: auto.masterCopy to Clipboard Copied! Toggle word wrap Toggle overflow
119.2. Setting up an NFS server with Kerberos in a Red Hat Enterprise Linux Identity Management domain Copiar enlaceEnlace copiado en el portapapeles!
If you use Red Hat Enterprise Linux Identity Management (IdM), you can join your NFS server to the IdM domain. This enables you to centrally manage users and groups and to use Kerberos for authentication, integrity protection, and traffic encryption.
Prerequisites
- The NFS server is enrolled in a Red Hat Enterprise Linux Identity Management (IdM) domain.
- The NFS server is running and configured.
Procedure
Obtain a kerberos ticket as an IdM administrator:
kinit admin
# kinit adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
nfs/<FQDN>service principal:ipa service-add nfs/nfs_server.idm.example.com
# ipa service-add nfs/nfs_server.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the
nfsservice principal from IdM, and store it in the/etc/krb5.keytabfile:ipa-getkeytab -s idm_server.idm.example.com -p nfs/nfs_server.idm.example.com -k /etc/krb5.keytab
# ipa-getkeytab -s idm_server.idm.example.com -p nfs/nfs_server.idm.example.com -k /etc/krb5.keytabCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Display the principals in the
/etc/krb5.keytabfile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, the IdM client adds the host principal to the
/etc/krb5.keytabfile when you join the host to the IdM domain. If the host principal is missing, use theipa-getkeytab -s idm_server.idm.example.com -p host/nfs_server.idm.example.com -k /etc/krb5.keytabcommand to add it.Use the
ipa-client-automountutility to configure mapping of IdM IDs:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update your
/etc/exportsfile, and add the Kerberos security method to the client options. For example:/nfs/projects/ 192.0.2.0/24(rw,sec=krb5i)
/nfs/projects/ 192.0.2.0/24(rw,sec=krb5i)Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you want that your clients can select from multiple security methods, specify them separated by colons:
/nfs/projects/ 192.0.2.0/24(rw,sec=krb5:krb5i:krb5p)
/nfs/projects/ 192.0.2.0/24(rw,sec=krb5:krb5i:krb5p)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reload the exported file systems:
exportfs -r
# exportfs -rCopy to Clipboard Copied! Toggle word wrap Toggle overflow
119.3. Configuring automount locations and maps in IdM using the IdM CLI Copiar enlaceEnlace copiado en el portapapeles!
A location is a set of maps, which are all stored in auto.master. A location can store multiple maps. The location entry only works as a container for map entries; it is not an automount configuration in and of itself.
As a system administrator in Identity Management (IdM), you can configure automount locations and maps in IdM so that IdM users in the specified locations can access shares exported by an NFS server by navigating to specific mount points on their hosts. Both the exported NFS server directory and the mount points are specified in the maps. The example describes how to configure the raleigh location and a map that mounts the nfs-server.idm.example.com:/exports/project share on the /devel/ mount point on the IdM client as a read-write directory.
Prerequisites
- You are logged in as an IdM administrator on any IdM-enrolled host.
Procedure
Create the raleigh automount location:
ipa automountlocation-add raleigh ---------------------------------- Added automount location "raleigh" ---------------------------------- Location: raleigh
$ ipa automountlocation-add raleigh ---------------------------------- Added automount location "raleigh" ---------------------------------- Location: raleighCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create an auto.devel automount map in the raleigh location:
ipa automountmap-add raleigh auto.devel -------------------------------- Added automount map "auto.devel" -------------------------------- Map: auto.devel
$ ipa automountmap-add raleigh auto.devel -------------------------------- Added automount map "auto.devel" -------------------------------- Map: auto.develCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the keys and mount information for the exports/ share:
Add the key and mount information for the auto.devel map:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the key and mount information for the auto.master map:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
119.4. Configuring automount on an IdM client Copiar enlaceEnlace copiado en el portapapeles!
As an Identity Management (IdM) system administrator, you can configure automount services on an IdM client so that NFS shares configured for a location to which the client has been added are accessible to an IdM user automatically when the user logs in to the client. The example describes how to configure an IdM client to use automount services that are available in the raleigh location.
Prerequisites
-
You have
rootaccess to the IdM client. - You are logged in as IdM administrator.
- The automount location exists. The example location is raleigh.
Procedure
On the IdM client, enter the
ipa-client-automountcommand and specify the location. Use the-Uoption to run the script unattended:ipa-client-automount --location raleigh -U
# ipa-client-automount --location raleigh -UCopy to Clipboard Copied! Toggle word wrap Toggle overflow Stop the autofs service, clear the SSSD cache, and start the autofs service to load the new configuration settings:
systemctl stop autofs ; sss_cache -E ; systemctl start autofs
# systemctl stop autofs ; sss_cache -E ; systemctl start autofsCopy to Clipboard Copied! Toggle word wrap Toggle overflow