Setup Open LDAP
Get the code
sudo aptitude install slapd ldap-utils
During installation it will ask for the admin password
Edit the config file /etc/ldap/slapd.conf I only made one change. For some reason the root name and password don't work. So right after the line ```sufix``` I added two lines for the root password and user name.
suffix "dc=passnet,dc=org" rootdn "cn=admin,dc=passnet,dc=org" rootpw tempsecrete
Now start and some to pick up the new root password settings. Then use ```ldappasswd``` to change the password. Then edi /etc/ldap/slapd.conf and remove the rootdn and rootpw lines.
sudo /etc/init.d/slapd restart ldappasswd -v -x -D cn=admin,dc=passnet,dc=org -S -W sudo vi /etc/ldap/slapd.conf sudo /etc/init.d/slapd restart
The passwords for new entries are encrypted, but I'm not sure how openldap knows how to do that.
Debian already set up an admin name, and I wanted to see what the database looked like.
sudo /etc/init.d/slapd stop sudo /usr/sbin/slapcat sudo /etc/init.d/slapd start
Next try to get ldapsearch working edit /etc/ldap/ldap.conf and make sure it has the right BASE and URI
URI ldap://localhost BASE dc=passnet,dc=org
Now lets try a search
ldapsearch -x cn=admin
There is also an ldapadd
ldapadd -v -x -D cn=admin,dc=passnet,dc=org -W < people.ldif
and an ldapdelete
ldapdelete -v -x -D cn=admin,dc=passnet,dc=org -W
For example if I want to add someone I would add a people branch and a person, by placing the following in a file and pumping it into ldapadd.
dn: ou=people,dc=passnet,dc=org objectClass: top objectClass: organizationalUnit ou: people dn: uid=ericp,ou=people,dc=passnet,dc=org uid: ericp cn: Eric Passmore sn: Passmore uidNumber: 1000 gidNumber: 1005 userPassword: special loginShell: /bin/bash homeDirectory: /home/ericp objectClass: posixAccount objectClass: person
Finally, if you want to backup your newly minted ldap database do this
sudo slapcat > entries.ldif
To restor those entries use slapadd.
slapadd -l entries.ldif