Differences between revisions 7 and 8
Revision 7 as of 2012-01-20 16:03:07
Size: 3014
Editor: ?MarcusOsdoba
Comment: schema conversion for autofs.schema to cn=config format
Revision 8 as of 2013-10-17 23:00:58
Size: 3014
Editor: ?MikeMcKiernan
Comment: Change autofs-ldap5 to the correct package name, autofs5-ldap
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 $ apt-get install autofs5 autofs-ldap5  $ apt-get install autofs5 autofs5-ldap

Getting automounter maps from LDAP

AutoFS Client Setup

The Squeeze standard kernel ships with autofs module needed for automounting. Install the autofs5,autofs5-ldap packages and optionally nfs-common.

 $ apt-get install autofs5 autofs5-ldap

Autofs mapping entries on LDAP

Actually, the autofs ldap backend supports three (3) different schema styles to store its automountmaps in an ldap. You can verify this by reading /etc/default/autofs #common ldap mappings.

Adding schema to OpenLDAP using cn=config

The schema file provided by the autofs5-ldap package /etc/ldap/schema/autofs.schema needs to be converted to ldif format when using the new cn=config backend for openldap (instead of slapd.conf). Create a file /tmp/schema_convert.conf with the following content

include         /etc/ldap/schema/core.schema
include         /etc/ldap/schema/cosine.schema
include         /etc/ldap/schema/autofs.schema

Create a temporary ldif output directory and run slaptest to generate autofs.ldif

# mkdir /tmp/ldif_output
# slaptest -f schema_convert.conf -F /tmp/ldif_output

Modify the resulting file in /tmp/ldif_output/cn=config/cn=schema/cn={2}autofs.ldif

dn: cn=autofs,cn=schema,cn=config
..
cn: autofs
..
<remove all lines from structuralObjectClass: olcSchemaConfig onwards>

The result should look like this: https://launchpadlibrarian.net/55451730/autofs.ldif If you like to, you may copy it over to /etc/ldap/schema/autofs.ldif. Finally add the ldif to your config database:

# ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/autofs.ldif

Store mappings on the ldap

To store eg. auto.home maps on LDAP you can use the following format (user and home mapping shown):

dn: uid=auser,ou=People,dc=example,dc=com
uid: auser
uidNumber: 1044
gidNumber: 501
gecos: A. User,,,
homeDirectory: /home/auser
loginShell: /bin/bash

dn: cn=auser,ou=auto.home,dc=example,dc=com
objectClass: automount
cn: auser
automountInformation: -rw,soft,intr,quota       homeserver:/export/home/&

Create a file autofs-data.ldif with the above content and add it to the ldap:

# ldapadd -D cn=admin,dc=example,dc=com -W -f autofs-data.ldif

Activate ldap lookup for autofs maps in /etc/nsswitch.conf

automount:      files ldap

Configure /etc/default/autofs with proper URI,SEARCHBASE and schema mapping definition. You can also use ldap on a directory basis and maintaining other directories via files as usual:

# auto.master file
/home   ldap:ou=auto.home,dc=example,dc=com

If not using anonymous binds on the ldap you need to edit /etc/autofs_ldap_auth.conf, too.

References


See Also: