OpenLDAP研究
架构
主要模块
- lloadd - stand-alone LDAP Load Balancer Daemon (server or slapd module)
- slapd - stand-alone LDAP daemon (server)
- libraries implementing the LDAP protocol, and
- utilities, tools, and sample clients.
相关的工程
- Fortress - Role-based identity access management Java SDK
- JLDAP - LDAP Class Libraries for Java
- JDBC-LDAP - Java JDBC - LDAP Bridge Driver
- LMDB - Lightning Memory-Mapped Database
命令
open ldap 的 bin 目录下的命令:
Command | Purpose | Example Usage |
---|---|---|
ldapadd |
Add entries to the LDAP directory. | ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f entry.ldif |
ldapmodify |
Modify existing LDAP entries. | ldapmodify -x -D "cn=admin,dc=example,dc=com" -W -f changes.ldif |
ldapdelete |
Delete entries. | ldapdelete -x -D "cn=admin,dc=example,dc=com" -W "uid=user1,ou=users,dc=example,dc=com" |
ldapsearch |
Search entries in the directory. | ldapsearch -x -b "dc=example,dc=com" "(uid=user1)" |
ldappasswd |
Reset user passwords. | ldappasswd -x -D "cn=admin,dc=example,dc=com" -W -s newpass "uid=user1,ou=users,dc=example,dc=com" |
ldapwhoami |
Check the DN of the authenticated user. | ldapwhoami -x -D "uid=user1,ou=users,dc=example,dc=com" -W |
ldapcompare |
Compare attribute values (e.g., for validation). | ldapcompare -x -D "cn=admin,dc=example,dc=com" -W "uid=user1,ou=users,dc=example,dc=com:userPassword=secret" |
查询命令
|
|
结果:
|
|
其他一系列命令:
|
|
查询所有
|
|
这里存储的 kerberos 的 keytab 实际是
- 经过了 ASN.1 加密,包含了一些其他信息
- 再做了 base64
类似下面解码过程
|
|
配置信息
/opt/openldap/etc/openldap/ cat slapd.ldif
|
|
Key Components of an LDIF File:
- dn: Distinguished Name, the unique identifier of an entry.
- objectClass: Defines the entry’s structure and allowed attributes.
- changetype: Specifies the operation (e.g., add, modify, delete).
Core Abbreviations
Abbreviation | Full Name | Definition & Example |
---|---|---|
CN | Common Name | Represents the name of an object (e.g., user/group). Example: cn=John Doe |
DN | Distinguished Name | Unique identifier for an entry, specifying its hierarchical path. Example: dn: uid=jdoe,ou=People,dc=example,dc=com |
OU | Organizational Unit | Container for grouping related entries (e.g., departments). Example: ou=Engineering,dc=example,dc=com |
DC | Domain Component | Represents a domain segment in the directory hierarchy. Example: dc=example,dc=com (domain “example.com”) |
UID | User Identifier | Unique username. Example: uid=jdoe |
SN | Surname | Last name. Example: sn=Doe |
C | Country | ISO 2-letter country code. Example: c=US |
O | Organization | Organization name. Example: o=Example Corp |
RDN | Relative Distinguished Name | Immediate part of a DN. Example: uid=jdoe in uid=jdoe,ou=People,dc=example,dc=com |