The suffix directive specifies the root of the LDAP tree. The simplest way is to use your domain code (e.g. linuxnetworks.de):
suffix "dc=linuxnetworks,dc=de"Furthermore we need somebody we can give all rights to add, modify or delete the tree. This is equivalent to the "root" account in Unix. Here it is often called the "Manager" account.
rootdn "cn=Manager,dc=linuxnetworks,dc=de"Finally, this Manager account must be protected by a password. It is highly recommended to store a hashed password in this config file. "slappasswd" can be used to create such a string, which can be inserted in the rootpw line.
rootpw <secrethashedpassword>
access to attr="userPassword" by self write by dn="cn=Manager,dc=linuxnetworks,dc=de" write by dn="cn=lmcadmin,ou=user,dc=linuxnetworks,dc=de" write by anonymous auth by * none access to dn=".*,ou=user,dc=linuxnetworks,dc=de" by dn="cn=Manager,dc=linuxnetworks,dc=de" write by dn="cn=lmcadmin,ou=user,dc=linuxnetworks,dc=de" write by * read access to * by dn="cn=Manager,dc=linuxnetworks,dc=de" write by * read
dn: dc=linuxnetworks,dc=de objectclass: top objectclass: dcObject dc: linuxnetworks dn: ou=user,dc=linuxnetworks,dc=de objectclass: top objectclass: organizationalUnit ou: user dn: cn=lmcadmin,ou=user,dc=linuxnetworks,dc=de objectclass: top objectclass: person objectclass: inetOrgPerson cn: lmcadmin sn: lmcadmin uid: lmcadmin userPassword: <secrethashedpassword>The contents of this file must be inserted into the OpenLDAP server. Therefore open a shell and type the following command (don't forget to replace second and top level domain):
ldapadd -D "cn=Manager,dc=linuxnetworks,dc=de" -W -x -f <file>You will be asked for the Manager password (this one you inserted into the slapd.conf) and then the entries will be written to the database. You can check it by typing
ldapsearch -x "objectclass=*"into the shell. Then you get a list of all objects (entries) which are in the database.
You can select the usage of a LDAP server for authentication and insert this parameters:
server: localhost basedn: ou=user,dc=linuxnetworks,dc=deDon't forget to replace "linuxnetworks" and "de" with your second and top level domain code.