ldap-demo/step.md

49 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 将LDIF文件复制到OpenLDAP容器
docker cp ldap-init.ldif openldap:/tmp/
# 导入数据
docker exec openldap ldapadd -x -D "cn=admin,dc=example,dc=com" -w admin -f /tmp/ldap-init.ldif
ldap
用户DN: cn=admin,dc=example,dc=com
密码: admin
RDN 是 Relative Distinguished Name相对可分辨名称的缩写是LDAP中的一个重要概念。
RDN 解释
1. 什么是RDN
RDN 是LDAP条目在其父容器中的唯一标识符
它是DNDistinguished Name的最左边部分
类似于文件系统中的文件名
2. 举例说明
完整DN: uid=Guwan,ou=people,dc=example,dc=com
RDN: uid=Guwan (最左边的部分)
父DN: ou=people,dc=example,dc=com
3. 常见的RDN格式
RDN格式 含义 用途
uid=john User ID 用户账户
cn=John Doe Common Name 人员或组
ou=people Organizational Unit 组织单位
dc=example Domain Component 域名组件
4. 在您的情况下
当您创建用户时系统会问您要使用什么作为RDN
选择 uid: 创建 uid=Guwan,ou=people,dc=example,dc=com
选择 cn: 创建 cn=Guwan,ou=people,dc=example,dc=com
5. 为什么重要
唯一性: 同一容器中不能有相同的RDN
引用: 其他系统如GitLab通过RDN来识别用户
搜索: LDAP搜索时RDN是重要的查找依据
6. 在创建用户界面中
当您看到RDN选择时
选择 uid 如果您想要 uid=Guwan 格式
选择 cn 如果您想要 cn=Guwan 格式
对于GitLab LDAP集成通常推荐使用 uid 作为RDN因为
更符合用户账户的标准
GitLab配置中使用 uid 字段进行认证
与其他现有用户uid=bob.wilson 等)保持一致