By Gerald Carter
Book Price: $39.95 USD
£28.50 GBP
PDF Price: $27.99
Cover | Table of Contents | Colophon
objectClasses. These
objectClasses have certain required or optional
attributes. Attribute types have defined encoding and matching rules
that govern such things as the type of data the attribute can hold
and how to compare this data during a search. This information model
will be covered extensively in the next chapter when we examine LDAP
schema.cn=gerald carter. Note
that the attribute name as well as the value are included in the RDN.
The DN for this node would be dc=plainjoe,dc=org:# LDIF listing for the entry dn: dc=plainjoe,dc=org dn: dc=plainjoe,dc=org objectClass: domain dc: plainjoe
ou=devices,dc=plainjoe,dc=org entry from Figure 2-1; it demonstrates the purpose of multivalued
attributes:# LDIF listing for dn: ou=devices,dc=plainjoe,dc=org dn: ou=devices,dc=plainjoe,dc=org objectclass: organizationalUnit ou: devices telephoneNumber: +1 256 555-5446 telephoneNumber: +1 256 555-5447 description: Container for all network enabled devices existing within the plainjoe.org domain
domain
object class and the
dc
attribute. Here is the original LDIF listing for the entry:# LDIF listing for the entry dn: dc=plainjoe,dc=org dn: dc=plainjoe,dc=org objectclass: domain dc: plainjoe
dn: o=plainjoe,l=AL,c=US
o attribute is the
organizationName, the l
attribute is the locality of the organization, and the
c attribute represents the country in which the
organization exists. However, there is no central means of
registering such names, and therefore no general way to refer to the
naming context of a directory server. RFC 2247 introduced a system by which LDAP
directory naming contexts can be piggybacked on top of an
organization's existing DNS infrastructure. Because
DNS domain names are guaranteed to be unique across the Internet and
can be located easily,
mapping an organization's
domain name to an LDAP DN provides a simple way of determining the
base suffix served by a directory and ensures that the naming context
will be globally unique.dc=plainjoe,dc=org. This context is used by the
LDAP server to determine whether it will be able to service a client
request. For example, our directory server will return an error (or
possibly a referral) to a client who attempts to look up the
information in an entry named cn=gerald
carter,ou=people,dc=taco,dc=org because the entry
would be outside our naming context.cn, c, and
sn. There is no single source of information
describing all possible LDAPv3 attribute types and object classes,
but there are a handful of online sites that can be consulted to
cover the most common schema items:http://www.rfc-editor.org/)http://ldap.akbkhome.com/)http://www.alvestrand.no/objectid/)http://docs.sun.com)person
object class and gives you an idea of what other attributes are
available for the cn=gerald
carter entry in Figure 2-1. In
particular, you will need to define a userPassword
attribute value to further explore LDAP authentication.
cn=gerald
carter is:dn: cn=gerald carter,ou=people,dc=plainjoe,dc=org
objectClass: person
cn: gerald carter
sn: carter
telephoneNumber: 555-1234
userPassword: {MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ= =
userPassword.
This attribute stores a representation of the credentials necessary
to authenticate a user. The prefix (in this case,
{MD5}) describes how the credentials are encoded.
The value in this case is simply the Base64 encoding of the MD5 hash
of the word "secret."userPassword values will be
covered in more detail in the context of various programming
languages and APIs in later chapters. Some common encoding types are:{CRYPT}
crypt( ) function, which
is normally included in the standard C library. The
{CRYPT} prefix will be seen quite a bit in Chapter 6 when we discuss using LDAP as a replacement
for NIS.people
ou were housed on
a separate host. There are many reasons for distributing the
directory tree across multiple hosts. These can include, but are not
limited to:
http://ietf.org/html.charters/ldup-charter.html.http://ietf.org/html.charters/ldapbis-charter.html.http://www.ldapzone.com) does provide a nice
collection of LDAP-related topics, forums, and downloads.
http://www.openldap.org/ under the OpenLDAP
Public License. Source code can provide a great deal of information
to supplement existing (or absent) documentation.http://www.padl.com//Articles/AdvancedOpenDirectoryConf.html.http://www.symas.com/.http://www.OpenLDAP.org/software/download/.
There are two major incarnations of OpenLDAP. The older 1.2 releases
are essentially enhancements or small bug fixes to the original
University of Michigan code base and implement only LDAPv2. The
OpenLDAP 2 branch is an LDAPv3-compliant implementation.http://www.openssl.org/).http://www.sleepycat.com/).http://asg.web.cmu.edu/sasl/sasl-library.html).http://www.gnu.ai.mit.edu/software/pth/related.html
for a list of known POSIX thread libraries for Unix systems.
It is possible to disable thread support in the OpenLDAP server,
slapd
,
by specifying the —disable-threads option
in the OpenLDAP configure script prior to compiling. However, the
replication helper daemon, slurpd, which is
covered in Chapter 5, requires thread support.ftp://ftp.porcupine.org/pub/security/index.html.$ gzip -dc openldap-2.1.8.tar.gz | tar xvf -
$ cd openldap-2.1.8/ $ ./configure --enable-wrappers
$ make depend $ make $ make test $ /bin/su -c "make install"
|
Name
|
Description
|
|---|---|
|
libexec/slapd
|
The LDAP server.
|
|
libexec/slurpd
|
The LDAP replication helper.
|
|
bin/ldapadd
bin/ldapmodify
bin/ldapdelete
bin/ldapmodrdn
|
Command-line tools for adding, modifying, and deleting entries on an
LDAP server. These commands support both LDAPv2 and LDAPv3.
|
|
bin/ldapsearch
bin/ldapcompare
|
# /usr/local/etc/openldap/slapd.conf
# Global section
## Global parameters removed for brevity's sake, for now . . .
#######################################################
# Database #1 - Berkeley DB
database bdb
## Database parameters and directives would go here.
#######################################################
# Database #2 - Berkeley DB
database bdb
## Database parameters and directives would go here.
## And so on . . .*
self
anonymous
users
dn="cn=gerald
carter,ou=people,dc=plainjoe,dc=org") or an SASL identify
(e.g., dn="uid=jerry,cn=gssapi,cn=auth"). The
self value is used as a shortcut for the DN of the
authenticated user of the current session. The examples later in this
section will help clarify this concept.compare access implies
auth access, and write access
implies read, search,
compare, and auth.# /usr/local/etc/openldap/slapd.conf
# Global section
## Include the minimum schema required.
include /usr/local/etc/openldap/schema/core.schema
## Added logging parameters
loglevel 296
pidfile /usr/local/var/slapd.pid
argsfile /usr/local/var/slapd.args
## TLS options for slapd
TLSCipherSuite HIGH
TLSCertificateFile /etc/local/slapd-cert.pem
TLSCertificateKeyFile /etc/local/slapd-key.pem
## Misc security settings
password-hash {SSHA}
#######################################################
## Define the beginning of example database.
database bdb
## Define the root suffix you serve.
suffix "dc=plainjoe,dc=org"
## Define a root DN for superuser privileges.
rootdn "cn=Manager,dc=plainjoe,dc=org"
## Define the password used with rootdn. This is the base64-encoded MD5 hash of
## "secret."
rootpw {SSHA}2aksIaicAvwc+DhCrXUFlhgWsbBJPLxy
## Directory containing the database files
directory /var/ldap/plainjoe.org
## Files should be created rw for the owner **only**.
mode 0600
## Indexes to maintain
index objectClass eq
index cn pres,eq
## db tuning parameters; cache 2,000 entries in memory
cachesize 2000
# Simple ACL granting read access to the world
access to *
by * read# /usr/local/etc/openldap/slapd.conf
# Global section
## Include the minimum schema required.
include /usr/local/etc/openldap/schema/core.schema
## Added logging parameters
loglevel 296
pidfile /usr/local/var/slapd.pid
argsfile /usr/local/var/slapd.args
## TLS options for slapd
TLSCipherSuite HIGH
TLSCertificateFile /etc/local/slapd-cert.pem
TLSCertificateKeyFile /etc/local/slapd-key.pem
## Misc security settings
password-hash {SSHA}
#######################################################
## Define the beginning of example database.
database bdb
## Define the root suffix you serve.
suffix "dc=plainjoe,dc=org"
## Define a root DN for superuser privileges.
rootdn "cn=Manager,dc=plainjoe,dc=org"
## Define the password used with rootdn. This is the base64-encoded MD5 hash of
## "secret."
rootpw {SSHA}2aksIaicAvwc+DhCrXUFlhgWsbBJPLxy
## Directory containing the database files
directory /var/ldap/plainjoe.org
## Files should be created rw for the owner **only**.
mode 0600
## Indexes to maintain
index objectClass eq
index cn pres,eq
## db tuning parameters; cache 2,000 entries in memory
cachesize 2000
# Simple ACL granting read access to the world
access to *
by * read
dc=plainjoe,dc=org
people organizational unit:ou=people,dc=plainjoe,dc=org
inetOrgPerson schema
defined in RFC 2798 is more than adequate. From
Section 3.5.1 in
Chapter 3, we know that this object class and
associated attributes are defined in OpenLDAP's
inetorgperson.schema
file. As shown in Figure 4-1, an inetOrgPerson is a
descendant of the
organizationalPerson
, which was itself derived from the
person
object class.inetOrgPerson
object class, you must include
inetorgperson.schema
,
core.schema
, and cosine.schema
in slapd.conf. The comments that begin
inetorgperson.schema outline the dependency on
the COSINE schema. Here are the modifications to the global section
of slapd.conf:# /usr/local/etc/openldap/slapd.conf
# Global section
## Include the minimum schema required.
include /usr/local/etc/openldap/schema/core.schema
## Added to support the inetOrgPerson object.
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
## Added logging parameters
. . .
cn attribute, you'll also index
the surname (sn) and email address
(mail) attributes. In addition to the equality
(eq) index, you'll add a
substring (sub) index to support searches such
as "All employees whose last names begin with
C." Finally, you will add an equality index for the
departmentNumber attribute so that users can
search for employees within a given department. This index would not
be necessary if the directory were laid out as shown in Figure 4-2 because the same effect could be achieved by
beginning the search at the department ou. Here
are the changes to the database section:## Indexes to maintain index objectClass eq index cn,sn,mail eq,sub index departmentNumber eq . . .
directory parameter
exists and has the proper permissions. In our example, that directory
is root# /usr/local/libexec/slapd
$ ps -ef | grep slapd root 8235 1 0 12:37 ? 00:00:00 /usr/local/libexec/slapd root 8241 8235 0 12:37 ? 00:00:00 /usr/local/libexec/slapd root 8242 8241 0 12:37 ? 00:00:00 /usr/local/libexec/slapd
INT signal, as shown here (the
pidfile location was defined in the
server's configuration file):root# kill -INT 'cat /var/run/slapd.pid'
|
Option
|
Description
|
|---|---|
|
-d integer
|
Specifies the log level to use for logging information. This option
causes |