Warning Livedoc is no longer being updated and will be deprecated shortly. Please refer to https://documentation.tjhsst.edu.


From Livedoc - The Documentation Repository
Revision as of 01:42, 13 January 2012 by Andrew Hamilton (talk | contribs) (Update NSS LDAP page for OpenLDAP setup)
Jump to: navigation, search

LDAP is used to store NSS (Name Service Switch) information for the UNIX passwd and group databases. All information about network users, such as UNIX uid/gid, home directory, shell, and other group membership is handled through NSS.


Previously, the CSL used NIS to store network user information. However, when the decision was made to integrate CSL accounts and authentication with Windows Active Directory (previously all CSL accounts were managed separately and required an application form to receive), LDAP was chosen to replace NIS as the backend for the NSS database.

Integrated authentication using LDAP and Kerberos was initially deployed in lab 231 during the spring of 2006. Sun Directory Server 5.2 was used at the time, replicated from sol across what are now known as chuku and ekhi. During the summer following, LDAP was moved into a VMWare virtual machine known as daystar in order to run LDAP on a faster system. However, for reasons not completely understood, the VM subsequently developed problems during the fall of 2006 and resulted in NSS becoming painfully slow on both rockhopper (at that time used for all of lab 231 and 16 LTSP nodes in the CSL) and the rest of the CSL workstations. In order to remedy the situation, /etc/passwd was rapidly deployed as a flatfile across all affected systems. Hesiod was subsequently set up as the NSS database for the remainder of the school year and the beginning of the next.

During the winter of 2007-08, NSS was switched back to LDAP following various discussions. (Need more information.) LDAP was configured on chuku and mihr, running Sun Directory Server 6.

Upon reception of the Sun Academic Excellence Grant, LDAP was moved into the LDOMs ldap1 and ldap2 running on Ohare and Logan.


NSS LDAP is currently used by nearly all *NIX systems managed by the CSL. It is running in the Xen VMs openldap1 and openldap2.

Configuring LDAP on clients


  • libnss-ldap (or similar) needs to be installed.
  • Edit /etc/libnss-ldap.conf:
    • Setup LDAP servers,, and
    • Use search base: dc=csl,dc=tjhsst,dc=edu.
    • Set bind_timelimit to 2
    • Set bind_policy to soft
    • Set nss_base_passwd to ou=people,
    • Set nss_base_group to ou=group,
  • Edit /etc/nsswitch.conf to use "compat ldap" for the passwd and group databases. The two lines should look like this:
passwd:     compat ldap
group:      compat ldap
  • You may need to restart nscd if it is installed.


WARNING: There was at least one point in the history of Sun Directory Server where setting up the LDAP client on the LDAP server was not supported because the client was started before the server was, causing a halt in system boot because of a failure to initialize the client. I'm not sure if this is still the case, but if it is, you will need an init script to disable the client in SMF until the server starts, and then restart the client after the server starts. In the CSL, this is easily done by installing the STJinitd-sunds package.

  • Run the following command:
/usr/sbin/ldapclient manual -a credentialLevel=anonymous \
 -a defaultSearchBase="dc=csl,dc=tjhsst,dc=edu" \
 -a defaultSearchScope=sub \
 -a defaultServerList="" \
 -a followReferrals="TRUE" \
 -a preferredServerList="" \
 -a serviceSearchDescriptor=passwd:ou=people,dc=csl,dc=tjhsst,dc=edu \
 -a serviceSearchDescriptor=group:ou=group,dc=csl,dc=tjhsst,dc=edu
  • On most CSL systems: You are done.
  • On stock Solaris systems (and possibly some CSL systems):
    • The ldapclient command has installed an nsswitch.conf that assumes you use LDAP for everything. And I mean EVERYTHING. But that's rarely the case anywhere. So cp /etc/nsswitch.dns /etc/nsswitch.conf. Then edit /etc/nsswitch.conf to use "files ldap" for passwd and group. See Linux section above for sample of what this will look like.
    • pkill nscd to restart it (Solaris 10), or restart it some other way.
  • NOTE: Solaris defaults to using files instead of compat to reference the local password and group databases. For more information on the differences between files and compat, you can run info libc “Name Service Switch” on a system with GNU info configured.

Admin-only access

Follow the above directions, but wherever you see an ou=people, replace it with an ou=sysadmins. Only sysadmins with LDAP entries in ou=sysadmins will be able to access that system. Note that additional access control can, and is often, managed by using hostname groups (i.e. the LDAP POSIX group named after the hostname of the system). This is currently not done on Solaris systems, but is done on most Linux systems.

LDAP Server Software

OpenLDAP's slapd is currently run in one-way replication on openldap1 (master) and openldap2. It can integrate with nsswitch to provide all NSS databases although we currently only use it for the passwd and group databases. For detailed installation and configuration notes, see OpenLDAP.

Service IP Caveats

The service IP for NSS LDAP is (ldap-sun.tjhsst.edu is the hostname; it remains what it is for historical reasons). Note that neither openldap1 nor openldap2 will automatically grab this IP at boot. This IP must be manually added. This is so that the IP can be moved during maintenance; for example, if openldap1 is down for maintenance, the IP is moved to openldap2 so correctly configured clients will query openldap2 instead. If openldap1 is rebooted as part of maintenance, it will not also snag the IP as it comes up and cause a network service conflict.

In the event that there is a complete power outage and both systems are rebooted, obviously the IP will not be assigned to either of them at boot. Correctly configured clients will not be impacted as they will rapidly timeout and fall back on openldap1 and openldap2 IP addresses.

Directory Structure

  • Everything below is relative to a root dn of dc=csl,dc=tjhsst,dc=edu.
  • Groups are referenced by cn (i.e. cn=allaccess,ou=group,dc=csl,dc=tjhsst,dc=edu). Users are referenced by uid (i.e. uid=wyang,ou=2008,ou=students,ou=people,dc=csl,dc=tjhsst,dc=edu).


This subtree contains POSIX groups. Currently we have 3 major classes of groups:

  • Primary: Each LDAP user's default group is one of these. There are a few subclasses:
    • Students/graduation year: The name of each group is TJ and then a two digit year, except in the case of 2000, which has name TJ2K. The gidnumber is the four digit graduation year.
    • "Adult" users: Staff members are assigned to group "faculty" with gidnumber 1984. Separating parents/external users into a separate group would be advisable, but they presently share the "faculty" group.
    • "users": This is presently used for all LDAP user entries in the ou=sysadmins subtree (see below).
  • Host/VM access control: Each of these groups (gid starting at 1000) has the hostname of the system that it is designed to control access for. The group has a list of users that should be granted login access to that system; however, some of the systems listed may not necessarily have group control implemented, rendering the LDAP group's membership moot. The group is not used to grant root access on a system; that is controlled independent of LDAP at this time. The members of the "allaccess" group (gid 1337) are grant login access on all systems that have the LDAP group access control scheme configured.
  • System/service groups: These are primarily used by the Solaris systems, but can also be used by others. It is sometimes easier to ensure that any particular group used by a system service will have the same ID across multiple systems by adding it to LDAP, hence the existence of this class of groups. These have gids starting at 5000.

There are some miscellaneous groups scattered in there. For instance, "commons_mm" (gid 8000) is the primary group for all music card users.


This is the subtree used for the NSS passwd database on all general use systems. It is itself made up of several more sub-ous. The major ones are listed below. Others may be created as needed (for example, the josti2008 ou contains temporary users that were created for a JOSTI 2008 interactive user experience in one particular presentation; although the users are still in LDAP, they cannot login because their Kerberos credentials are expired).


Most NIS users were loaded into this ou so legacy accounts could still have their uids looked up, and previous admins that retained their Kerberos accounts can still log in. Some NIS users were not imported because their username already existed in one of the other ous.


Parents that have login access for website editing or for whatever other purpose go here. Some parents may actually be in ou=legacy if they were created during the NIS era.


This contains things that don't belong in any other category. Some system service users go here (see "System/service groups" in the ou=group section above for why we do this). Music card users also go here, although they could also have their own ou since there seem to be enough of them nowadays.

  • IMPORTANT: Most users that are added here should also be added to the ou=special in ou=sysadmins (see below).


Well yes...faculty and staff have their own ou. Naturally.


No student users go directly in here; they go into another subou under this ou by graduation year first. At time of writing, ous exist for 2006 through 2050 (most of these latter ones are empty).


This contains...well...sysadmins. The distinction from ou=people is primarily for access control on non-general-use servers.


This is basically a copy of ou=special from above. The difference is that non-general-use servers are configured to see this ou=special, while general-use systems see the one in ou=people. For example, it is important to have the music card users here and above since music card users are logged in to on a general use system, but the NFS server, which is non-general use, also needs to be able to look up the username and uid.


See OpenLDAP for general ways to administer Sun Directory Server.

Some potentially useful commands

Here are a few complex commands that have been used in the past that may come in handy at one point or another in the future. Note that the commands assume you understand the command syntax; they are usually incomplete by themselves, or they may be out-of-date: To look up users that have a home directory but don't exist in LDAP:

for i in `ls -1`; do if [ "`ldapsearch -h chuku -p 388 -x -b ou=2011,ou=students,ou=people,dc=csl,dc=tjhsst,dc=edu -LLL uid=$i  dn`" = "" ]; then echo $i; fi;done

To look up users that are in LDAP but are missing a home directory:

for i in `ldapsearch -h chuku -p 388 -x -b ou=2011,ou=students,ou=people,dc=csl,dc=tjhsst,dc=edu -LLL uid=* dn|cut -d"=" -f2|cut -d"," -f1`; do if [ ! -d $i ] ; then echo $i;fi; done

See Also