我正在尝试设置一个本地 LDAP 实例,以便调试一些使用 LDAP 进行身份验证的软件。我让这个在 Ubuntu 14.04 LTS 上正常工作,但是试图通过盒子升级到 Ubuntu 16.04 LTS,我重新安装了从头开始的 Ubunut 16.04 LTS,并且在非常沮丧之后无法让 LDAP 正常工作。
我安装了 slapd 并用于slapadd -l <file>
填充我的数据库。我可以看到我的文件已加载ldapsearch -x
:
# extended LDIF
#
# LDAPv3
# base <dc=nodomain> (default) with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# nodomain
dn: dc=nodomain
objectClass: top
objectClass: dcObject
objectClass: organization
o: nodomain
dc: nodomain
# admin, nodomain
dn: cn=admin,dc=nodomain
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
# People, nodomain
dn: ou=People,dc=nodomain
objectClass: organizationalUnit
ou: People
# Groups, nodomain
dn: ou=Groups,dc=nodomain
objectClass: organizationalUnit
ou: Groups
# miners, Groups, nodomain
dn: cn=miners,ou=Groups,dc=nodomain
objectClass: posixGroup
cn: miners
gidNumber: 5000
# smm, People, nodomain
dn: uid=smm,ou=People,dc=nodomain
uid: smm
sn: McCants
givenName: Stephen
cn: Stephen McCants
displayName: Stephen McCants
uidNumber: 10000
gidNumber: 5000
gecos: Stephen McCants
loginShell: /bin/bash
homeDirectory: /home/smm
objectClass: top
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetOrgPerson
objectClass: person
# search result
search: 2
result: 0 Success
# numResponses: 7
# numEntries: 6
但是,我的代码无法针对用户 'smm' 进行身份验证,并且我无法为用户设置密码ldappasswd -D "uid=smm,ou=People,dc=nodomain" -A -S -W
。它提示我输入密码,然后失败并出现相同的错误:
Old password:
Re-enter old password:
New password:
Re-enter new password:
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
我还用来dpkg-reconfigure slapd
设置 LDAP root 密码。但是,在重新配置之前和之后,我都会遇到同样的错误。这是用于填充数据库的原始文件:
n: ou=People,dc=nodomain
objectClass: organizationalUnit
ou: People
structuralObjectClass: organizationalUnit
entryUUID: 03a28690-1834-1033-87f5-8b9136017cf0
creatorsName: cn=admin,dc=nodomain
createTimestamp: 20140123043856Z
entryCSN: 20140123043856.559226Z#000000#000#000000
modifiersName: cn=admin,dc=nodomain
modifyTimestamp: 20140123043856Z
dn: ou=Groups,dc=nodomain
objectClass: organizationalUnit
ou: Groups
structuralObjectClass: organizationalUnit
entryUUID: 03b017e2-1834-1033-87f6-8b9136017cf0
creatorsName: cn=admin,dc=nodomain
createTimestamp: 20140123043856Z
entryCSN: 20140123043856.648148Z#000000#000#000000
modifiersName: cn=admin,dc=nodomain
modifyTimestamp: 20140123043856Z
dn: cn=miners,ou=Groups,dc=nodomain
objectClass: posixGroup
cn: miners
gidNumber: 5000
structuralObjectClass: posixGroup
entryUUID: 03b537ae-1834-1033-87f7-8b9136017cf0
creatorsName: cn=admin,dc=nodomain
createTimestamp: 20140123043856Z
entryCSN: 20140123043856.681730Z#000000#000#000000
modifiersName: cn=admin,dc=nodomain
modifyTimestamp: 20140123043856Z
dn: uid=smm,ou=People,dc=nodomain
uid: smm
sn: <my name>
givenName: <my name>
cn: <my name>
displayName: <my name>
uidNumber: 10000
gidNumber: 5000
gecos: <my name>
loginShell: /bin/bash
homeDirectory: /home/smm
structuralObjectClass: inetOrgPerson
entryUUID: 983bd260-1835-1033-87fb-8b9136017cf0
creatorsName: cn=admin,dc=nodomain
createTimestamp: 20140123045015Z
objectClass: top
objectClass: posixAccount
objectClass: shadowAccount
objectClass: inetOrgPerson
objectClass: person
userPassword: <redacted>
entryCSN: 20140123054441.631096Z#000000#000#000000
modifiersName: cn=admin,dc=nodomain
modifyTimestamp: 20140123054441Z
当然,包含我的真实姓名并包含由slappasswd
.
在这一点上,我不知道为什么它不起作用以及问题是什么。