Mastering OpenLDAP

Book description

If you want to go beyond the fundamentals of OpenLDAP, this is the guide you need. Starting with the basics of installation, it progresses to sophisticated aspects of the server for web applications and services.

  • Up-to-date with the latest OpenLDAP release
  • Installing and configuring the OpenLDAP server
  • Synchronizing multiple OpenLDAP servers over the network
  • Creating custom LDAP schemas to model your own information
  • Integrating OpenLDAP with web applications

In Detail

This book is the ideal introduction to using OpenLDAP for Application Developers and will also benefit System Administrators running OpenLDAP. It prepares the reader to build a directory using OpenLDAP, and then employ this directory in the context of the network, taking a practical approach that emphasizes how to get things done. On occasion, it delves into theoretical aspects of LDAP, but only where understanding the theory helps to answer practical questions. The reader requires no knowledge of OpenLDAP, but even readers already familiar with the technology will find new things and techniques.

This book is organized into three major sections: the first section covers the basics of LDAP directory services and the OpenLDAP server; the second focuses on building directory services with OpenLDAP; in the third section of the book, we look at how OpenLDAP is integrated with other applications and services on the network. This book not only demystifies OpenLDAP, but gives System Administrators and Application Developers a solid understanding of how to make use of OpenLDAP's directory services.

The OpenLDAP directory server is a mature product that has been around (in one form or another) since 1995. It is an open-source server that provides network clients with directory services. All major Linux distributions include the OpenLDAP server, and many major applications, both open-source and proprietary, are directory aware and can make use of the services provided by OpenLDAP.

The OpenLDAP directory server can be used to store organizational information in a centralized location, and make this information available to authorized applications. Client applications connect to OpenLDAP using the Lightweight Directory Access Protocol (LDAP) and can then search the directory and (if they have appropriate access) modify and manipulate records.

LDAP servers are most frequently used to provide network-based authentication services for users; but there are many other uses for an LDAP server, including using the directory as an address book, a DNS database, an organizational tool, or even as a network object store for applications.

Table of contents

  1. Mastering OpenLDAP
    1. Table of Contents
    2. Mastering OpenLDAP
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. Preface
      1. What This Book Covers
      2. What You Need for This Book
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Downloading the Example Code for the Book
        2. Errata
        3. Questions
    7. 1. Directory Servers and LDAP
      1. LDAP Basics
        1. What is a Directory?
        2. The Structure of a Directory Entry
        3. A Unique Name: The DN
        4. An Example LDAP Entry
          1. The Object Class Attribute
          2. Operational Attributes
        5. The Directory Information Tree
        6. What to Do with an LDAP Server
      2. The History of LDAP and OpenLDAP
      3. A Technical Overview of OpenLDAP
        1. The Server
        2. Clients
        3. Utilities
        4. Libraries
      4. Summary
    8. 2. Installation and Configuration
      1. Before Getting Started
        1. OpenLDAP Binaries for Operating Systems
          1. Commercial OpenLDAP Distribution
          2. Source Code Compilation
        2. A Quick Note on Versions
      2. Installation
        1. Dependencies
        2. Installing OpenLDAP
      3. Configuring the SLAPD Server
        1. Basics
          1. Schemas
          2. More Directives
          3. Module Directives
        2. Database Configuration
        3. ACLs
        4. Verifying a Configuration File
      4. Starting and Stopping the Server
        1. Using the Init Script
        2. Running SLAPD Directly
      5. Configuring the LDAP Clients
        1. A Basic ldap.conf File
          1. Size and Time Limits
      6. Testing the Server
      7. Summary
    9. 3. Using OpenLDAP
      1. A Brief Survey of the LDAP Suite
      2. LDAP from the Server Side
        1. SLAPD
          1. The Binding Operation
          2. The Search Operation
          3. More Operations: Additions, Modifications, and Deletions
            1. The Addition Operation
            2. The Modification Operation
            3. The Delete Operation
          4. Infrequent Operations
            1. The ModifyDN Operation
            2. The Compare Operation
            3. The Extended Operation
          5. SLAPD Summary
        2. SLURPD
      3. Creating Directory Data
        1. The LDIF File Format
          1. Anatomy of an LDIF File
          2. Representing Attribute Values in LDIF
        2. Example.Com in LDIF
          1. Defining the Base DN Record
          2. Structuring the Directory with Organizational Units
            1. Theory 1: Directory as Organizational Chart
            2. Theory 2: Directory as IT Service
            3. Expressing the OUs in LDIF
          3. Adding User Records
          4. Adding System Records
          5. Adding Group Records
        3. The Complete LDIF File
      4. Using the Utilities to Prepare the Directory
        1. slapadd
          1. When Should slapadd be Used?
          2. What Does slapadd Do?
          3. Loading the LDIF File
            1. Stopping the Server
            2. Running ldapadd in Test Mode
            3. Importing the Records Using slapadd
            4. Restarting the Directory
            5. If Something Went Wrong...
            6. Destroying and Recreating the Directory Files
        2. slapindex
        3. slapcat
          1. Operational Attributes
        4. slapacl
        5. slapauth
        6. slapdn
        7. slappasswd
          1. Storing and Using Passwords in OpenLDAP
          2. Generating a Password with slappasswd
        8. slaptest
      5. Performing Directory Operations Using the Clients
        1. Common Command-Line Flags
          1. Common Flags
          2. Setting Defaults in ldap.conf
        2. ldapsearch
          1. A Simple Search
          2. Restricting Returned Fields
          3. Requesting Operational Attributes
          4. Searching Using a File
        3. ldapadd
          1. Adding Records from a File
        4. ldapmodify
          1. Adding a Record with ldapmodify
          2. Modifying Existing Records
          3. Modifying the Relative DN
            1. Moving a Record with modrdn
          4. Deleting Entire Records
        5. ldapdelete
        6. ldapcompare
        7. ldapmodrdn
          1. Modifying the Superior DN with ldapmodrdn
        8. ldappasswd
        9. ldapwhoami
      6. Summary
    10. 4. Securing OpenLDAP
      1. LDAP Security: The Three Aspects
      2. Securing Network-Based Directory Connections with SSL/TLS
        1. The Basics of SSL and TLS
          1. Authenticity
          2. Encryption
          3. StartTLS
        2. Creating an SSL/TLS CA
        3. Creating a Certificate
          1. Creating a New Certificate Request
          2. Signing the Certificate Request
          3. Configuring and Installing the Certificates
            1. Remove the Pass Phrase from the Key
            2. Relocate the Certificates
            3. Install the CA Certificate
            4. Optional: Clean Up
        4. Configuring StartTLS
        5. Configuring Client TLS
        6. Configuring LDAPS
          1. Debugging with the OpenSSL Client
        7. Using Security Strength Factors
          1. The security Directive
            1. A Fine-Grained security Directive
      3. Authenticating Users to the Directory
        1. Simple Binding
          1. Using an Authentication User for Simple Binding
        2. SASL Binding
          1. Configuring Cyrus SASL
            1. The SASL Configuration File
            2. Setting a User Password
          2. Configuring SLAPD for SASL Support
            1. Using a Replacement String in authz-regexp
            2. Using a Search Filter in authz-regexp
            3. A Note on ACLs and Search Filters
            4. Failure of Mapping
            5. Removing the Need to Specify the Realm
            6. Debugging the SASL Configuration
        3. Using Client SSL/TLS Certificates to Authenticate
          1. Creating a New Client Certificate
          2. Configuring the Client
          3. Configuring the Server
          4. Testing with ldapwhoami
          5. Going Further with SASL
      4. Controlling Authorization with ACLs
        1. The Basics of ACLs
        2. Access to [resources]
          1. Access using DN
          2. Access using attrs
          3. Access using Filters
          4. Combining Access Specifiers
        3. By [who] [type of access granted] [control]
          1. The Access Field
          2. The who Field
            1. The * and anonymous Specifiers
            2. The self Specifier
            3. The users Specifier
            4. The dn Specifier
            5. Groups and Members
            6. Member-Based Record Access
            7. Network, Connections, and Security
            8. Advanced Step: Using the set Specifier
          3. The control Field
        4. Getting More from Regular Expressions
        5. Debugging ACLs
        6. A Practical Example
      5. Summary
    11. 5. Advanced Configuration
      1. Multiple Database Backends
        1. The slapd.conf File
        2. Creating and Importing a Second Directory
      2. Performance Tuning
        1. Performance Directives
          1. Global Directives
            1. Time Limits
            2. Idle Timeouts
            3. Size Limits
            4. Threads
          2. Directives in the Database Section
            1. Limits
            2. Read-only and Restrict Directives
            3. Index (BDB/HDB Backends Only)
            4. Controlling the Cache (BDB/HDB Only)
            5. Reducing Disk I/O Latency (BDB/HDB Only)
        2. The DB_CONFIG File
          1. Setting the Cache Size
          2. Configuring the Data Directory
          3. Optimizing BDB/HDB Transaction Logging
          4. Tuning Lock Files
          5. More about Berkeley DB
      3. Directory Overlays
        1. A Brief Tour of the Official Overlays
        2. Configuring an Overlay: denyop
          1. Loading the module
          2. Adding the Overlay
          3. Adding Overlay-Specific Directives
        3. Referential Integrity Overlay
          1. Configuring the Overlay
          2. Modifying the Records
          3. Drawbacks
          4. A Useful Note
      4. The Uniqueness Overlay
      5. Summary
    12. 6. LDAP Schemas
      1. Introduction to LDAP Schemas
        1. Why Do They Look So Complicated?
        2. Schema Definitions
        3. Object Classes and Attributes
        4. Object Class Definitions
        5. Attribute Definitions
        6. Object Identifier Definitions
        7. DIT Content Rules
        8. Retrieving the Schemas from SLAPD
      2. The ObjectClass Hierarchy
        1. Attribute Hierarchies
          1. Subordinate Attributes and Searching
        2. Object Class Types: Abstract, Structural, and Auxiliary
          1. The Object Class Hierarchy: An Overview
          2. Abstract Classes
          3. Structural Object Classes
          4. Auxiliary Object Classes
        3. Moving Onward
      3. Schemas: Accesslog and Password Policy Overlays
        1. Logging with the Accesslog Overlay
          1. Loading the accesslog Module
          2. Configuring the Access Log Backend
          3. Creating A Directory for the Access Log Files
          4. Enabling Logging for the Main Backend
          5. The Log Records
        2. Implementing a Complex Overlay: Password Policy
          1. Setting the Global Directives in slapd.conf: Schema and Module
          2. Creating a Password Policy
          3. Configure the Overlay Directives
          4. Test the Overlay
          5. Password Policy Operational Attributes
          6. Summary of ppolicy Operational Attributes
      4. Creating a Schema
        1. Getting an OID
        2. Giving Our OID a Name
        3. Creating Object Classes
        4. Creating Attributes
        5. Loading the New Schema
          1. Troubleshooting Schema Loading
        6. A New Record
      5. Summary
    13. 7. Multiple Directories
      1. Replication: An Overview
        1. SyncRepl
      2. Configuring SyncRepl
        1. Configuring the Master Server
          1. Creating a SyncRepl User
        2. Configuring the Shadow Server
          1. The syncrepl Directive
          2. Configuring a Referral
        3. Starting Replication
          1. For Larger Directories...
        4. Delta SyncRepl
          1. The Master Server's Configuration
          2. The Shadow Server's Configuration
        5. Debugging SyncRepl
          1. Starting Over
          2. Strategic Logging
          3. A Few Common Mistakes
      3. Configuring an LDAP Proxy
        1. Using the LDAP Backend
          1. Using Identity Management Features
        2. Turning the Simple Proxy into a Caching Proxy
          1. Notes on the Attribute Sets and Templates
        3. A Translucent Proxy
      4. Summary
    14. 8. LDAP and the Web
      1. The LDAP-Aware Application
      2. Apache and LDAP
        1. A Short Guide to Installing Apache
        2. Configuring LDAP Authentication
          1. Loading the Modules
          2. Editing the default Configuration File
            1. The Directory Section—Apache 2.2
            2. Changes in Apache 2.0
          3. Other Features of the Require Parameter
      3. phpLDAPadmin
        1. Prerequisites
        2. Installing phpLDAPadmin
          1. Is Your Package Broken?
        3. Configuring phpLDAPadmin
          1. A Basic Look at Configuration Parameters
            1. Setting a variable
            2. Calling a function
            3. Setting an Array Value
          2. Configuring the LDAP Server Settings
        4. A First Look at phpLDAPadmin
          1. Navigating phpLDAPadmin
          2. Viewing and Modifying a Record
          3. Adding a New Record
          4. Searching with phpLDAPadmin
      4. Summary
    15. A. Building OpenLDAP from Source
      1. Why Build from Source?
      2. Getting the Code
      3. The Tools for Compiling
        1. Build Tools
        2. Installing Dependencies
      4. Compiling OpenLDAP
        1. Configuring
        2. Building with make
      5. Installation
      6. Building Everything
      7. Summary
    16. B. LDAP URLs
      1. The LDAP URL
      2. Common Uses of LDAP URLs
        1. Not all LDAP URLs are for Searching
      3. For More Information on LDAP URLs...
      4. Summary
    17. C. Useful LDAP Commands
      1. Getting Information about the Directory
        1. The Root DSE
        2. The Subschema Record
        3. The Configuration Record
      2. Making a Directory Backup
        1. A Backup Copy of the Directory Database
        2. An LDIF Backup File
      3. Rebuilding a Database (BDB, HDB)
        1. Step 1: Stop the Server
        2. Step 2: Dump the Database
        3. Step 3: Delete the Old Database Files
        4. Step 4: Create a New Database
        5. Step 5: Restart SLAPD
        6. Troubleshooting Rebuilds
      4. Summary
    18. Index

Product information

  • Title: Mastering OpenLDAP
  • Author(s): Matt Butcher
  • Release date: August 2007
  • Publisher(s): Packt Publishing
  • ISBN: 9781847191021