Directory Server Linux
Directory Server Linux
Directory Server Linux
DIRECTORY Servers:
17.1. OpenLDAP
17.1.1. Introduction to LDAP
17.1.2. Installing the OpenLDAP Suite
17.1.3. Configuring an OpenLDAP Server
17.1.4. Running an OpenLDAP Server
17.1.5. Configuring a System to Authenticate Using OpenLDAP
17.1.6. Additional Resources
17.1. OpenLDAP
LDAP (Lightweight Directory Access Protocol) is a set of open protocols used to access
centrally stored information over a network. It is based on the X.500 standard for
directory sharing, but is less complex and resource-intensive. For this reason, LDAP is
sometimes referred to as “X.500 Lite”.
LDAP is commonly used for centrally managed users and groups, user authentication,
or system configuration. It can also serve as a virtual phone directory, allowing users
to easily access contact information for other users. Additionally, it can refer a user
to other LDAP servers throughout the world, and thus provide an ad-hoc global
repository of information. However, it is most frequently used within individual
organizations such as universities, government departments, and private companies.
This section covers the installation and configuration of OpenLDAP 2.4, an open
source implementation of the LDAPv2 and LDAPv3 protocols.
The LDAP server supports several database systems, which gives administrators the
flexibility to choose the best suited solution for the type of information they are
planning to serve. Because of a well-defined client Application Programming Interface
(API), the number of applications able to communicate with an LDAP server is
numerous, and increasing in both quantity and quality.
entry
A single unit within an LDAP directory. Each entry is identified by its unique
Distinguished Name (DN).
attribute
Information directly associated with an entry. For example, if an organization
is represented as an LDAP entry, attributes associated with this organization
might include an address, a fax number, etc. Similarly, people can be
represented as entries with common attributes such as personal telephone
number or email address.
LDIF
The LDAP Data Interchange Format (LDIF) is a plain text representation of an
LDAP entry. It takes the following form:
[id] dn: distinguished_name
attribute_type: attribute_value…
attribute_type: attribute_value…
…
The optional id is a number determined by the application that is used to edit
the entry. Each entry can contain as many attribute_type and
attribute_value pairs as needed, as long as they are all defined in a
corresponding schema file. A blank line indicates the end of an entry.
LDAPv3 Support — Many of the changes in the protocol since LDAP version 2 are
designed to make LDAP more secure. Among other improvements, this includes the
support for Simple Authentication and Security Layer (SASL), Transport Layer
Security (TLS), and Secure Sockets Layer (SSL) protocols.
LDAP Over IPC — The use of inter-process communication (IPC) enhances security by
eliminating the need to communicate over a network.
IPv6 Support — OpenLDAP is compliant with Internet Protocol version 6 (IPv6), the
next generation of the Internet Protocol.
LDIFv1 Support — OpenLDAP is fully compliant with LDIF version 1.
Updated C API — The current C API improves the way programmers can connect to
and use LDAP directory servers.
Enhanced Standalone LDAP Server — This includes an updated access control system,
thread pooling, better tools, and much more.
1. Install the OpenLDAP suite. Refer to Section 17.1.2, “Installing the OpenLDAP Suite”
for more information on required packages.
2. Customize the configuration as described in Section 17.1.3, “Configuring an OpenLDAP
Server”.
3. Start the slapd service as described in Section 17.1.4, “Running an OpenLDAP
Server”.
4. Use the ldapadd utility to add entries to the LDAP directory.
5. Use the ldapsearch utility to verify that the slapd service is accessing the information
correctly.
Package Description
openldap- A package containing the command line utilities for viewing and
clients modifying directories on an LDAP server.
Additionally, the following packages are commonly used along with the LDAP server:
Package Description
To install these packages, use the yum command in the following form:
For example, to perform the basic LDAP server installation, type the following at a
shell prompt:
Note that you must have superuser privileges (that is, you must be logged in as root)
to run this command. For more information on how to install new packages in Red Hat
Enterprise Linux, refer to Section 6.2.4, “Installing Packages”.
Command Description
slapadd Allows you to add entries from an LDIF file to an LDAP directory.
slapauth Allows you to check a list of IDs for authentication and authorization
permissions.
slapcat Allows you to pull entries from an LDAP directory in the default format
and save them in an LDIF file.
Command Description
slapindex Allows you to re-index the slapd directory based on the current
content. Run this utility whenever you change indexing options in the
configuration file.
slappasswd Allows you to create an encrypted user password to be used with the
ldapmodify utility, or in the slapd configuration file.
For a detailed description of these utilities and their usage, refer to the
corresponding manual pages as referred to in Section 17.1.6.1, “Installed
Documentation”.
Stopping slapd: [ OK ]
For more information on how to start, stop, restart, and check the current status of
the slapd service, refer to Section 17.1.4, “Running an OpenLDAP Server”.
17.1.2.2. Overview of OpenLDAP Client Utilities
The openldap-clients package installs the following utilities which can be used to add,
modify, and delete entries in an LDAP directory:
Command Description
ldapadd Allows you to add entries to an LDAP directory, either from a file, or
from standard input. It is a symbolic link to ldapmodify -a.
ldapcompare Allows you to compare given attribute with an LDAP directory entry.
ldapmodify Allows you to modify entries in an LDAP directory, either from a file,
or from standard input.
ldapmodrdn Allows you to modify the RDN value of an LDAP directory entry.
ldappasswd Allows you to set or change the password for an LDAP user.
With the exception of ldapsearch, each of these utilities is more easily used by
referencing a file containing the changes to be made rather than typing a command
for each entry to be changed within an LDAP directory. The format of such a file is
outlined in the man page for each utility.
Path Description
olcAllows
The olcAllows directive allows you to specify which features to enable. It takes
the following form:
olcAllows: feature…
Option Description
olcConnMaxPending
The olcConnMaxPending directive allows you to specify the maximum number of
pending requests for an anonymous session. It takes the following form:
olcConnMaxPending: number
The default option is 100.
olcConnMaxPending: 100
olcConnMaxPendingAuth
The olcConnMaxPendingAuth directive allows you to specify the maximum
number of pending requests for an authenticated session. It takes the following
form:
olcConnMaxPendingAuth: number
olcConnMaxPendingAuth: 1000
olcDisallows
The olcDisallows directive allows you to specify which features to disable. It
takes the following form:
olcDisallows: feature…
Option Description
olcDisallows: bind_anon
olcIdleTimeout
The olcIdleTimeout directive allows you to specify how many seconds to wait
before closing an idle connection. It takes the following form:
olcIdleTimeout: number
olcIdleTimeout: 180
olcLogFile
The olcLogFile directive allows you to specify a file in which to write log
messages. It takes the following form:
olcLogFile: file_name
olcLogFile: /var/log/slapd.log
olcReferral
The olcReferral option allows you to specify a URL of a server to process the
request in case the server is not able to handle it. It takes the following form:
olcReferral: URL
olcReferral: ldap://root.openldap.org
olcWriteTimeout
The olcWriteTimeout option allows you to specify how many seconds to wait
before closing a connection with an outstanding write request. It takes the
following form:
olcWriteTimeout
olcWriteTimeout: 180
olcReadOnly
The olcReadOnly directive allows you to use the database in a read-only mode.
It takes the following form:
olcReadOnly: boolean
olcRootDN
The olcRootDN directive allows you to specify the user that is unrestricted by
access controls or administrative limit parameters set for operations on the
LDAP directory. It takes the following form:
olcRootDN: distinguished_name
olcRootDN: cn=root,dn=example,dn=com
olcRootPW
The olcRootPW directive allows you to set a password for the user that is
specified using the olcRootDN directive. It takes the following form:
olcRootPW: password
It accepts either a plain text string, or a hash. To generate a hash, type the
following at a shell prompt:
~]$ slappaswd
New password:
{SSHA}WczWsyPEnMchFf1GRTweq2q7XJcvmSxD
olcRootPW: {SSHA}WczWsyPEnMchFf1GRTweq2q7XJcvmSxD
olcSuffix
The olcSuffix directive allows you to specify the domain for which to provide
information. It takes the following form:
olcSuffix: domain_name
It accepts a fully qualified domain name (FQDN). The default option is dc=my-
domain,dc=com.
olcSuffix: dc=example,dc=com
Starting slapd: [ OK ]
If you want the service to start automatically at the boot time, use the following
command:
Stopping slapd: [ OK ]
To prevent the service from starting automatically at the boot time, type:
Stopping slapd: [ OK ]
Starting slapd: [ OK ]
This stops the service, and then starts it again. Use this command to reload the
configuration.
$DEFAULT_MAIL_DOMAIN = "example.com";
# Default base
$DEFAULT_BASE = "dc=example,dc=com";
Alternatively, you can specify the environment variables directly on the command
line. For example, to run the migrate_all_online.sh script with the default base set
to dc=example,dc=com, type:
/usr/share/migrationtools/migrate_all_online.sh
To decide which script to run in order to migrate the user database, refer to
Table 17.8, “Commonly used LDAP migration scripts”.
NetInfo no migrate_all_netinfo_offline.sh
For more information on how to use these scripts, refer to the README and the
migration-tools.txt files in the /usr/share/doc/migrationtools-version/ directory.
/usr/share/doc/openldap-servers-version/guide.html
A copy of the OpenLDAP Software Administrator's Guide.
/usr/share/doc/openldap-servers-version/README.schema
A README file containing the description of installed schema files.
Additionally, there is also a number of manual pages that are installed with the
openldap, openldap-servers, and openldap-clients packages:
Client Applications
man ldapadd — Describes how to add entries to an LDAP directory.
man ldapdelete — Describes how to delete entries within an LDAP directory.
man ldapmodify — Describes how to modify entries within an LDAP directory.
man ldapsearch — Describes how to search for entries within an LDAP directory.
man ldappasswd — Describes how to set or change the password of an LDAP
user.
man ldapcompare — Describes how to use the ldapcompare tool.
man ldapwhoami — Describes how to use the ldapwhoami tool.
man ldapmodrdn — Describes how to modify the RDNs of entries.
Server Applications
man slapd — Describes command line options for the LDAP server.
Administrative Applications
man slapadd — Describes command line options used to add entries to a slapd
database.
man slapcat — Describes command line options used to generate an LDIF file
from a slapd database.
man slapindex — Describes command line options used to regenerate an index
based upon the contents of a slapd database.
man slappasswd — Describes command line options used to generate user
passwords for LDAP directories.
Configuration Files
man ldap.conf — Describes the format and options available within the
configuration file for LDAP clients.
man slapd-config — Describes the format and options available within the
configuration directory.
http://www.kingsmountain.com/ldapRoadmap.shtml
Jeff Hodges' LDAP Roadmap & FAQ containing links to several useful resources
and emerging news concerning the LDAP protocol.
http://www.ldapman.org/articles/
A collection of articles that offer a good introduction to LDAP, including
methods to design a directory tree and customizing directory structures.
http://www.padl.com/
A website of developers of several useful LDAP tools.