I'm trying to set up a local LDAP instance so I can debug some software that uses LDAP for authentication. I had this working correctly on Ubuntu 14.04 LTS, but trying to upgrade to Ubuntu 16.04 LTS nuked by box and I reinstalled for scratch Ubunut 16.04 LTS and cannot get LDAP working correctly after much frustration.
I installed slapd and used slapadd -l <file>
to populate my database. I can see that my file has been loaded in with 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
However, my code cannot authenticate against the user 'smm' and I cannot set a password on the user with ldappasswd -D "uid=smm,ou=People,dc=nodomain" -A -S -W
. It prompts me for the passwords and then fails with the same error:
Old password:
Re-enter old password:
New password:
Re-enter new password:
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
I also used dpkg-reconfigure slapd
to set a LDAP root password. However, both before and after reconfiguring, I get the same error. Here is the original file that was used to populate the database:
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
Of course, contains my real name and contains the SSHA string generated by slappasswd
.
At this point, I'm at a loss as to why it doesn't work and what the problem is.