13.2.7. Configuring Services: autofs
About Automount, LDAP, and SSSD
Automount maps are commonly flat files, which define a relationship between a map, a mount directory, and a fileserver. (Automount is described in the Storage Administration Guide.)
For example, let's say that there is a fileserver called
nfs.example.com which hosts the directory pub, and automount is configured to mount directories in the /shares/ directory. So, the mount location is /shares/pub. All of the mounts are listed in the auto.master file, which identifies the different mount directories and the files which configure them. The auto.shares file then identifies each file server and mount directory which goes into the /shares/ directory. The relationships could be viewed like this:
Every mount point, then, is defined in two different files (at a minimum): the
auto.master and auto.whatever file, and those files have to be available to each local automount process.
One way for administrators to manage that for large environments is to store the automount configuration in a central LDAP directory, and just configure each local system to point to that LDAP directory. That means that updates only need to be made in a single location, and any new maps are automatically recognized by local systems.
For automount-LDAP configuration, the automount files are stored as LDAP entries, which are then translated into the requisite automount files. Each element is then translated into an LDAP attribute.
The LDAP entries look like this:
The schema elements, then, match up to the structure like this (with the RFC 2307 schema):
autofs uses those schema elements to derive the automount configuration. The /etc/sysconfig/autofs file identifies the LDAP server, directory location, and schema elements used for automount entities:
Rather than pointing the automount configuration to the LDAP directory, it can be configured to point to SSSD. SSSD, then, stores all of the information that automount needs, and as a user attempts to mount a directory, that information is cached into SSSD. This offers several advantages for configuration — such as failover, service discovery, and timeouts — as well as performance improvements by reducing the number of connections to the LDAP server. Most important, using SSSD allows all mount information to be cached, so that clients can still successfully mount directories even if the LDAP server goes offline.
Procedure 13.4. Configuring autofs Services in SSSD
- Make sure that the autofs and sssd-common packages are installed.
- Open the
sssd.conffile.vim /etc/sssd/sssd.conf
~]# vim /etc/sssd/sssd.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the
autofsservice to the list of services that SSSD manages.[sssd] services = nss,pam,autofs ....
[sssd] services = nss,pam,autofs ....Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a new
[autofs]service configuration section. This section can be left blank; there is only one configurable option, for timeouts for negative cache hits.This section is required, however, for SSSD to recognize theautofsservice and supply the default configuration.[autofs]
[autofs]Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The automount information is read from a configured LDAP domain in the SSSD configuration, so an LDAP domain must be available. If no additional settings are made, then the configuration defaults to the RFC 2307 schema and the LDAP search base (
ldap_search_base) for the automount information. This can be customized:- The directory type,
autofs_provider; this defaults to theid_providervalue; a value of none explicitly disables autofs for the domain. - The search base,
ldap_autofs_search_base. - The object class to use to recognize map entries,
ldap_autofs_map_object_class - The attribute to use to recognize map names,
ldap_autofs_map_name - The object class to use to recognize mount point entries,
ldap_autofs_entry_object_class - The attribute to use to recognize mount point names,
ldap_autofs_entry_key - The attribute to use for additional configuration information for the mount point,
ldap_autofs_entry_value
For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Save and close the
sssd.conffile. - Configure
autofsto look for the automount map information in SSSD by editing thensswitch.conffile and changing the location fromldaptosss:vim /etc/nsswitch.conf
# vim /etc/nsswitch.conf automount: files sssCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart SSSD.
service sssd restart
# service sssd restartCopy to Clipboard Copied! Toggle word wrap Toggle overflow