Batch 3: SQL Databases LDAP YAML ← Full TOC

← LDAP Index

📂 LDAP Concepts — Directory structure, DNs, object classes, attributes

LDAP (Lightweight Directory Access Protocol) is a protocol for accessing and maintaining distributed directory information services. Used for authentication, authorization, and storing user/group information. Active Directory, OpenLDAP, and FreeIPA all implement LDAP.

📋 Reference

ItemSyntax / ValueDescription
DirectoryHierarchical tree of entries — like a filesystemLDAP stores data in a tree structure called the DIT
DITDirectory Information TreeThe entire tree structure of LDAP entries
EntryA single record in the directoryLike a row in a database — identified by its DN
DNDistinguished Name: uid=alice,ou=users,dc=mwu,dc=comUnique path to an entry — like a full filesystem path
RDNRelative Distinguished Name: uid=aliceThe leftmost component of a DN — unique among siblings
dcDomain Component: dc=mywebuniversity,dc=comTop-level domain components
ouOrganizational Unit: ou=usersContainer for grouping entries
cnCommon Name: cn=Alice SmithFull name of a person or object
uidUser ID: uid=aliceUnix-style username
snSurname: sn=SmithLast name attribute
givenNamegivenName: AliceFirst name attribute
mailmail: alice@example.comEmail address attribute
objectClassobjectClass: inetOrgPersonDefines which attributes an entry must/may have
SchemaDefines objectClasses and attribute typesRules for what attributes entries can have
inetOrgPersonPerson + organizational + internet attributesMost common objectClass for user accounts
posixAccountUnix account attributes: uid, gidNumber, homeDirectoryObjectClass for Unix/Linux users
groupOfNamesGroup objectClass with member DNsGroup containing member Distinguished Names
posixGroupUnix group: gidNumber, memberUidUnix group objectClass
LDIFLDAP Data Interchange FormatText format for importing/exporting LDAP data
BindAuthenticate to the LDAP serverLike logging in — provide DN and password
Anonymous bindConnect without credentialsRead-only access to public directory info
Simple bindProvide DN + password in plaintextBasic authentication — use TLS!
SASL bindSimple Auth and Security LayerKerberos, GSSAPI, DIGEST-MD5 authentication
Base DNStarting point for a searchThe root of the search subtree
Search scopebase / one / sub (subtree)How deep to search from base DN
Search filter(objectClass=inetOrgPerson)RFC 4515 filter expression for matching entries
LDAPSLDAP over SSL/TLS on port 636Encrypted LDAP — always use in production
StartTLSTLS upgrade on standard port 389Upgrade unencrypted connection to TLS
ReferralRedirect to another LDAP serverDistribute directory across servers
ReplicationMaster-replica or multi-master syncKeep multiple LDAP servers synchronized

💡 Example

# LDAP Directory Structure — conceptual overview

# Typical DIT (Directory Information Tree):
#
# dc=mywebuniversity,dc=com              (root / base DN)
# ├── ou=users                           (organizational unit)
# │   ├── uid=alice,ou=users,dc=...      (user entry)
# │   ├── uid=bob,ou=users,dc=...
# │   └── uid=carol,ou=users,dc=...
# ├── ou=groups                          (groups container)
# │   ├── cn=admins,ou=groups,dc=...     (group entry)
# │   ├── cn=developers,ou=groups,dc=...
# │   └── cn=students,ou=groups,dc=...
# ├── ou=services                        (service accounts)
# │   └── uid=ldap-bind,ou=services,...
# └── ou=computers                       (computer accounts)
#     └── cn=webserver01,ou=computers,...

# Distinguished Name examples:
# uid=alice,ou=users,dc=mywebuniversity,dc=com
# cn=admins,ou=groups,dc=mywebuniversity,dc=com
# cn=webserver01,ou=computers,dc=mywebuniversity,dc=com

# LDAP Search Filter examples:
# (objectClass=inetOrgPerson)             -- all person entries
# (uid=alice)                             -- specific user
# (mail=*@mywebuniversity.com)            -- email wildcard
# (&(objectClass=posixAccount)(uid=*))    -- AND filter
# (|(uid=alice)(uid=bob))                 -- OR filter
# (!(uid=admin))                          -- NOT filter
# (&(objectClass=inetOrgPerson)(sn=Smith)(givenName=Alice))  -- compound
# (memberOf=cn=admins,ou=groups,dc=mwu,dc=com)  -- AD memberOf

# LDAP Attributes for a user entry:
# dn: uid=alice,ou=users,dc=mywebuniversity,dc=com
# objectClass: top
# objectClass: person
# objectClass: organizationalPerson
# objectClass: inetOrgPerson
# objectClass: posixAccount
# uid: alice
# cn: Alice Smith
# sn: Smith
# givenName: Alice
# displayName: Alice Smith
# mail: alice@mywebuniversity.com
# telephoneNumber: +1-555-0100
# title: Senior Developer
# departmentNumber: Engineering
# employeeNumber: 1001
# userPassword: {SSHA}hashedpassword
# uidNumber: 10001
# gidNumber: 5000
# homeDirectory: /home/alice
# loginShell: /bin/bash
# shadowLastChange: 19000
# shadowExpire: -1

🏠 Index  |  LDIF Format →