[CentOS] Autofs cannot bind LDAP server

Wed Dec 2 16:03:13 UTC 2009
Eric B. <ebenze at hotmail.com>

> "Alan McKay" <alan.mckay at gmail.com> wrote in
> message news:844129e80912011526o16aa6aen206a1cf7676a5b0e at mail.gmail.com...
> > I'm using Autofs and LDAP for mounting my home directories via nfs. In
> > general, everything seems to work fine. However, I have one small
> > problem.
> > If I reboot my server using autofs while my LDAP server is down, I get
> > the
> > following error message in my logs:
>
> I can't help you - but can you help me by pointing me to the docs you
> used to get this far?

Holy cow.  It wasn't easy... I had to do a lot of digging around to find the
necessary stuff, and unfortunately, don't have all the links any more.  I
did a lot of searching online using LDAP and autofs as query strings.  Some
of the links I found were the following that helped me understand.  Mind
you, none were "howto" recepies as such.


http://www.linuxtopia.org/online_books/rhel5/rhel5_administration/rhel5_s1-nfs-client-config-autofs.html
http://www.openldap.org/faq/data/cache/599.html


In a nutshell (if memory serves properly), you needed to do the following 
(this is all assuming you already have a functional LDAP server up and 
running and properly configured in your nsswitch.conf files and your 
ldap.conf files, etc).

1) Add the autofs schema to your ldap server (add the following line to the
slapd.conf file:  include
/etc/openldap/schema/redhat/autofs.schema).  I don't remember if I already
had the autofs.schema file or not, or if I had to search for it.

2) Modify your /etc/sysconfig/autofs to uncomment:
#
MAP_OBJECT_CLASS="automountMap"
ENTRY_OBJECT_CLASS="automount"
MAP_ATTRIBUTE="ou"
ENTRY_ATTRIBUTE="cn"
VALUE_ATTRIBUTE="automountInformation"


3)  Create an ldif file and import into your LDAP server to show the
following.  Note, that my NFS server has the home directories located at
/var/nfs/home/<user name>.  Your mapping may be different.

dn: ou=auto.home,dc=domain,dc=com
objectClass: top
objectClass: automountMap
ou: auto.home

dn: cn=/,ou=auto.home,dc=domain,dc=com
objectClass: automount
cn: /
automountInformation: -rsize=8192,wsize=8192,intr
nfs_server.domain.com:/var/nfs/home/&

dn: ou=auto.master,dc=domain,dc=com
objectClass: top
objectClass: automountMap
ou: auto.master

dn: cn=/home,ou=auto.master,dc=domain,dc=com
objectClass: automount
cn: /home
automountInformation:
ldap:ldap_server.domain.com:ou=auto.home,dc=domain,dc=com


4) Cross your fingers and restart your ldap server and your autofs daemon
and hope it works.  I got this working on CentOS 5.3.

Hope this helps.  I remember having to do a lot of digging around, a lot of
searching and a lot of trial and error to get it working.  But hopefully the
above points should at least set you off in the correct path.  Keep in mind 
I am by far no expert - I just poked around until I got it working, and once 
I did, stepped away from it.

Good luck.

Eric