General

LDAP can be used to store different type of information like:

  • Users, Groups - a central place to get your login credentials, most common case.
    It's a NIS replacement for this scenario.
  • Address Book - list information about people working for a company, client lists.
  • Network configuration - printer hosts, servers and such.
  • DHCP - the dhcp server needs patching for this to work.
  • DNS - information used by the name resolver can be stored here.

Compilation

Precompiled packages are already provided for your Linux distribution.
In case you want to compile from sources the LDAP server here are the informations on how to do it.

Requirements

Package dependencies:

  • Required
  • Optional:

Flags

A list of flags to enable for compilation.

Configuration

The files to configure openLDAP can be found in the /etc/openldap dir.

Server configuration (slapd)

Basic setup

The /etc/openldap/slapd.conf is the file used by slapd daemon. Here is an example of configuration file:

# The schemas establish the available attributes for an entry
# They are stored in /etc/openldap/schemas

include      /etc/openldap/schema/core.schema
include      /etc/openldap/schema/cosine.schema
include      /etc/openldap/schema/inetorgperson.schema
include      /etc/openldap/schema/extension.schema

# If no access controls are present, the default policy allows anyone and everyone to read anything but restricts
# updates to rootdn.  (e.g., "access to * by * read")

# This gives everybody read access and to users read + write
access to *
   by users write
   by * read

# This is needed by Outlook to work !!
allow bind_v2

pidfile         /usr/var/run/slapd.pid
argsfile        /usr/var/run/slapd.args

# Load dynamic backend modules:
# modulepath    /usr/libexec/openldap
# moduleload    back_bdb.la
# moduleload    back_ldap.la
# moduleload    back_ldbm.la
# moduleload    back_passwd.la
# moduleload    back_shell.la

# Databased used - Berkley DB which is the one that we get the app compiled.
database        bdb
suffix          "dc=prolix,dc=ro"
# rootdn can always read and write EVERYTHING!
rootdn          "cn=admin,dc=prolix,dc=ro"

# The password for the admin
rootpw          s3cr3t

# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools. 
# Mode 700 recommended.
directory       /usr/var/openldap-data

# Indices to maintain, this will speed up searching
index   cn,sn,givenName         pres,eq,sub
  1. Before starting slapd make sure that the database directory /usr/var/openldap-data exists with 700 access rights.
  2. Ports used by the ldap server are:
    • 389/tcp, 389/udp - plain text LDAP access
    • 636/tcp, 636/udp - ldap over TSL/SSL

Schemas

Are stored in /etc/openldap/schema and used by slapd. The schemas define the structure of the information to be stored in ldap directory.

Debugging problems

  1. Messages are log-ed using the syslog facility. Check /var/log/messages.
  2. Check the validity of the default configuration file with:
    $/usr/libexec/slapd -t
  3. Enable extra debug messages to be printed on stderr with:
    $/usr/libexec/slapd -d 255

Client configuration (command line clients)

The client will take it's configuration options from one of the following places (in the following order):

  1. /etc/openldap/ldap.conf - system wide defaults to be used by LDAP clients.
  2. $HOME/.ldaprc - user configuration files
  3. $CWD/.ldaprc - configuration in the current directory

Here is an example of configuration of /etc/openldap/ldap.conf

base    dc=prolix,dc=ro
# The URI is used in case we want to access LDAP as a client running on another machine
# URI    ldap://prolix.ro

Populating the LDAP database

ldapadd

This utility shiped with the openldap package can be used to import data in an LDAP database.
IMPORTANT: The file to be imported must be in LDIF format.

$ldapadd -x -D "cn=admin,dc=prolix,dc=ro" -W -f ldapimport.ldif

Web clients

Other administration tools

Other tutorials

If none of the information on this page solved your problem than look here for more information:


linux/openldap.txt · Last modified: 2006/06/07 02:34 (external edit)