Base installation about slapd daemon
shell# apt-get install slapd ldap-utils
Provide the LDAP administrator password
Setting up libltdl7 (2.2.6b-2) …
Setting up libperl5.10 (5.10.1-17squeeze2) …
Setting up libslp1 (1.2.1-7.8) …
Setting up ldap-utils (2.4.23-7.2) …
Setting up odbcinst (2.2.14p2-1) …
Setting up odbcinst1debian2 (2.2.14p2-1) …
Setting up unixodbc (2.2.14p2-1) …
Setting up slapd (2.4.23-7.2) …
Creating new user openldap… done.
Creating initial configuration… done.
Creating LDAP directory… done.
Starting OpenLDAP: slapd.
Test the slapd daemon
root@LDAP-02:~# ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b cn=config dn
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
dn: cn=config
dn: cn=module{0},cn=config
dn: cn=schema,cn=config
dn: cn={0}core,cn=schema,cn=config
dn: cn={1}cosine,cn=schema,cn=config
dn: cn={2}nis,cn=schema,cn=config
dn: cn={3}inetorgperson,cn=schema,cn=config
dn: olcBackend={0}hdb,cn=config
dn: olcDatabase={-1}frontend,cn=config
dn: olcDatabase={0}config,cn=config
dn: olcDatabase={1}hdb,cn=config
Setup the SHA LDAP administrator password in the config database
shell# slappasswd
{SSHA}XXXXXXXXXXXXXXXXXXXXXXXXXX
shell# ldapmodify -Y EXTERNAL -H ldapi:///
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
Cute & Paste
dn: olcDatabase={0}config,cn=config
add: olcRootPW
olcRootPW: {SSHA}XXXXXXXXXXXXXXXXXXXXXXXXXX
modifying entry "olcDatabase={0}config,cn=config"
Display the LDAP server configuration
shell# slapcat
dn: dc=thor,dc=loc
objectClass: top
objectClass: dcObject
objectClass: organization
o: thor.loc
dc: thor
structuralObjectClass: organization
entryUUID: c4db9414-a018-1030-8c55-0544f97800ac
creatorsName: cn=admin,dc=thor,dc=loc
createTimestamp: 20111110185139Z
entryCSN: 20111110185139.949528Z#000000#000#000000
modifiersName: cn=admin,dc=thor,dc=loc
modifyTimestamp: 20111110185139Z
dn: cn=admin,dc=thor,dc=loc
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword:: e1NTSEF9bjMvbzA1UnFWTGFYTlBUMzlPZUxJNlBEZXNzZUhlN24=
structuralObjectClass: organizationalRole
entryUUID: c503f1b6-a018-1030-8c56-0544f97800ac
creatorsName: cn=admin,dc=thor,dc=loc
createTimestamp: 20111110185140Z
entryCSN: 20111110185140.214073Z#000000#000#000000
modifiersName: cn=admin,dc=thor,dc=loc
modifyTimestamp: 20111110185140Z
Configure the LDAP database
File: config.ldif
IOF>
dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=thor,dc=loc
-
replace: olcRootDN
olcRootDN: cn=admin,dc=thor,dc=loc
-
replace: olcAccess
olcAccess: to attrs=userPassword by dn="cn=admin,dc=thor,dc=loc" write by anonymous auth by self write by * none
olcAccess: to attrs=shadowLastChange by self write by * read
olcAccess: to dn.base="" by * read
olcAccess: to * by dn="cn=admin,dc=thor,dc=loc" write by * read
-
<EOF
shell# ldapmodify -Y EXTERNAL -H ldapi:/// -f config.ldif
SASL/EXTERNAL authentication started
SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth
SASL SSF: 0
modifying entry "olcDatabase={1}hdb,cn=config"
Test the new configuration
sheel# ldapsearch -xLLL -b cn=config -D cn=admin,cn=config -W olcDatabase={1}hdb
Enter LDAP Password:
dn: olcDatabase={1}hdb,cn=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: {1}hdb
olcDbDirectory: /var/lib/ldap
olcLastMod: TRUE
olcRootPW: {SSHA}n3/o05RqVLaXNPT39OeLI6PDesseHe7n
olcDbCheckpoint: 512 30
olcDbConfig: {0}set_cachesize 0 2097152 0
olcDbConfig: {1}set_lk_max_objects 1500
olcDbConfig: {2}set_lk_max_locks 1500
olcDbConfig: {3}set_lk_max_lockers 1500
olcDbIndex: objectClass eq
olcSuffix: dc=thor,dc=loc
olcRootDN: cn=admin,dc=thor,dc=loc
olcAccess: {0}to attrs=userPassword by dn="cn=admin,dc=thor,dc=loc" write by a
nonymous auth by self write by * none
olcAccess: {1}to attrs=shadowLastChange by self write by * read
olcAccess: {2}to dn.base="" by * read
olcAccess: {3}to * by dn="cn=admin,dc=thor,dc=loc" write by * read