Here in this lab the software is already on the computer in a specially made package. So:
|
include /server/ldap/etc/openldap/schema/core.schema include /server/ldap/etc/openldap/schema/cosine.schema include /server/ldap/etc/openldap/schema/nis.schema include /server/ldap/etc/openldap/schema/inetorgperson.schema |
Schema (objectclasses and attributetypes) which should be supported. These are all important and standardized objectclasses for person entries and other essentials | ||
|
pidfile /server/ldap/var/run/slapd.pid argsfile /server/ldap/var/run/slapd.args |
Paths and files which
contain the process-id and the parameters of the running slapd |
||
|
access to * by * read |
Access configuration which grants read access to everyone. (Note: Always use normalized DNs - no spaces after commas) For more about access control see below | ||
| ####### | One database for each naming context. We will use ldbm for "dc=ceenet, dc=ceu,dc=hu". | ||
| database ldbm |
Type of database. Default: ldbm. Options: ldap, dnssrv, shell, sql |
||
| suffix "dc=ceenet,dc=ceu,dc=hu" | DN of the naming context. | ||
|
rootdn "cn=Manager,dc=ceenet,dc=ceu,dc=hu" rootpw secret |
DN of the root user and his password. If bound as rootdn, no access and operational restrictions apply. Cleartext passwords, especially for the rootdn, should be avoid. Use of strong authentication is encouraged. | ||
| directory /server/ldap/var/openldap-ldbm | Directory where OpenLDAP will store the files for this database. This database directory MUST exist prior to running slapd AND should only be accessible by the slapd/tools. Mode 700 recommended. | ||
|
index objectClass eq index cn eq,sub |
Indices to maintain |
||
| pres | for use in presence filters (e.g. gn=*) | ||
| eq | equality matching | ||
| sub | substring matching | ||
| approx | approximate matching (not supported in OpenLDAP 2; falls back to equality matching) | ||
| Level | Description |
| -1 | enable all debugging |
| 0 | no debugging |
| 1 | trace function calls |
| 2 | debug packet handling |
| 4 | heavy trace debugging |
| 8 | connection management |
| 16 | print out packets sent and received |
| 32 | search filter processing |
| 64 | configuration file processing |
| 128 | access control list processing |
| 256 | stats log connections/operations/results |
| 512 | stats log entries sent |
| 1024 | print communication with shell backends |
| 2048 | print entry parsing debugging |
dn: dc=ceenet,dc=ceu,dc=hu objectclass: dcObject objectclass: organization dc: ceenet o: CEENET Workshop 2001 dn:cn=Manager,dc=ceenet,dc=ceu,dc=hu objectclass: organizationalRole cn: Manager
Load it with the following steps:
Now lets add some more data. There is an LDIF file that contains a new subtree ou=people and some person entries:
dn: ou=people,dc=ceenet,dc=ceu,dc=hu objectclass: organizationalUnit ou: people dn: uid=scarter,ou=people,dc=ceenet,dc=ceu,dc=hu cn: Sam Carter sn: Carter givenname: Sam objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson ou: Accounting ou: People l: Sunnyvale uid: scarter mail: scarter@tutorial.hu telephonenumber: +1 408 555 4798 facsimiletelephonenumber: +1 408 555 9751 roomnumber: 4612 userpassword: sprain dn: uid=tmorris,ou=people,dc=ceenet,dc=ceu,dc=hu cn: Ted Morris sn: Morris givenname: Ted objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson ou: Accounting ou: People l: Santa Clara uid: tmorris mail: tmorris@tutorial.hu telephonenumber: +1 408 555 9187 facsimiletelephonenumber: +1 408 555 8473 roomnumber: 4117 userpassword: irrefutable dn: uid=xxx,ou=people,dc=ceenet,dc=ceu,dc=hu cn: xxx xxx sn: xxx givenname: xxx objectclass: top objectclass: person objectclass: organizationalPerson objectclass: inetOrgPerson ou: ldap tutorial ou: People l: Budapest uid: xxx mail: xxx@xxx.hu telephonenumber: xxx facsimiletelephonenumber: xxx roomnumber: 108 userpassword: xxx

Search
for a person

The current access controls provide global read access. We'll now change them, so that only authenticated users can read entries and only members of the administators group can change entries others than their own.
OpenLDAP know different access levels: write, read,
search,compare,auth,none. write also grants read
which also grants search and so on.
ACL are evaluated on a first match basis.
access
|
to dn.subtree="dc=ceenet,dc=ceu,dc=hu"
attr=userPassword
|
this ACL controls the userPassword attribute in the dc=ceenet,dc=ceu,dc=hu subtree |
|
by self write
|
write access, if bound as this entry |
|
by dn="cn=Manager,dc=ceenet,dc=ceu,dc=hu" write
|
write access for the administators group |
|
by anonymous auth
|
unauthenticated users can bind as this entry |
access
|
to dn.subtree="dc=ceenet,dc=ceu,dc=hu"
|
this ACL controls the dc=ceenet,dc=ceu,dc=hu subtree |
|
by self write
|
write access, if bound as the entry |
|
by dn="cn=Manager,dc=ceenet,dc=ceu,dc=hu" write
|
write access for the administators group |
|
by users read
|
read access for authenticated users |
access
|
to *
|
all the rest |
|
by * read
|
read access by all (Note: necessary to make rootDSE readable) |
To activate this new access control policy you need to kill and restart the server
ldap.php is a small php script that demonstrates session based
authentication via LDAP. It also gives a list view of person entries in the
directory.