AutoFS 5 and LDAP

I figured this out a while back, after trying to find some sort of documentation about it and failing. I posted it on the internal wiki we have, and then Pat blogged about it before I could actually paste it onto my own blog. So, I’m posting it here for redundancy.

AutoFS in LDAP

Changes in autofs4 made it possible to store automount maps inside LDAP, rather than storing maps in the filesystem that pointed to LDAP for the entries. It appears that in autofs5 if you have entries in LDAP for automount maps, the maps themselves must also be in LDAP (at least, this seems like the default behavior and there is no documentation describing how to override the default).

Which LDAP server?

This information is stored in /etc/openldap/ldap.conf — the default hostname, base, and search type for command-line requests; i.e., via ldapsearch.

Data in LDAP

To find which mountpoints autofs will be handled, it searches LDAP for entries with objectclass automountMap. It then searches all subordinate entries under the resulting list of mountpoints (automountMap entries) with the objectclass automount, each representing a directory to mount.

Each entry under automountMap points to a different branch of the LDAP tree, which stores one entry per automount describing the directory to be mounted. Example autofs map:

automountMap and subtree:

dn: ou=auto.master,ou=Mounts,ou=FOO,o=DOMAIN,c=US
objectClass: top
objectClass: automountMap
ou: auto.master

dn: cn=/home,ou=auto.master,ou=Mounts,ou=FOO,o=DOMAIN,c=US
objectClass: top
objectClass: automount
cn: /home
automountInformation: auto.home

The above instructs autofs that the auto.master map contains the mount point for /home. It also instructs autofs where to find the “map” for which directories will be mounted under /home — the auto.home map.

Let us examine the auto.home automount map:

dn: ou=auto.home,ou=Mounts,ou=FOO,o=DOMAIN,c=US
objectClass: top
objectClass: automountMap
ou: auto.home

dn: cn=user0,ou=auto.home,ou=Mounts,ou=FOO,o=DOMAIN,c=US
objectClass: top
objectClass: automount
cn: user0
automountInformation: filer:/vol/vol1/staff/user0

dn: cn=user1,ou=auto.home,ou=Mounts,ou=FOO,o=DOMAIN,c=US
objectClass: top
objectClass: automount
cn: user1
automountInformation: filer:/vol/vol1/staff/user1

The above constitutes the auto.home map in that all entries are directories that autofs is responsible for in the /home mount point.


About this entry