Tuesday, January 29, 2008

LDAP address book in Debian

#apt-get install slapd ldap-utils ldapscripts


edit /etc/ldap/slapd.conf
----------------------------
//change the suffix accodring to your domain. here "example.com.bd"
suffix "dc=example,dc=com,dc=bd"

//uncomment this line
rootdn "cn=admin,dc=example,dc=com,dc=bd"

//add after rootdn line (it is plain text password)
rootpw secret

//change the dc=example,dc=com,dc=bd everywhere in slapd.conf
//keep other config as it is.

restart ldap
#/etc/init.d/slapd restart

edit /etc/ldap/ldap.conf


create a file name directory.ldif in /etc/ldap/schema/

directory.ldif
----------------
dn: dc=example,dc=com,dc=bd
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: Example Inc.

dn: ou=addressbook, dc=example,dc=com,dc=bd
objectClass: top
objectClass: organizationalUnit
ou: addressbook




from shell cd to /etc/ldap/schema/
$ldapadd -x -D 'cn=admin,dc=example,dc=com,dc=bd' -f directory.ldif -W
(give pass secret here)


To check
$ldapsearch -b 'dc=example,dc=com,dc=bd' 'objectclass=*' -x


Input data using phpldapadmin

#apt-get install phpldapadmin

http://localhost/phpldapadmin/

login: cn=admin,dc=example,dc=com,dc=bd
pass: secret

or you can add data manually

create a file contact.ldif in /etc/ldap/schema/

contact.ldif
--------------
dn: cn=Blogger OS, ou=addressbook,dc=example,dc=com,dc=bd
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Blogger
gn: Ldap
sn: OS
mail: blogger@example.com.bd
physicalDeliveryOfficeName: Dhaka, Bangladesh.
postalAddress: PO BOX 909
ou: addressbook
st: LA
postalCode: 1215
telephoneNumber: 111-111-1111
facsimileTelephoneNumber:
111-111-1111
pager:
111-111-1111
mobile:
111-111-1111
homePhone:
111-111-1111

from shell cd to /etc/ldap/schema/
$ldapadd -x -D 'cn=admin,dc=example,dc=com,dc=bd' -f contact.ldif -W
(give pass secret here)

To check
$ldapsearch -b 'dc=example,dc=com,dc=bd' 'objectclass=*' -x



Reference:
ONLamp.com Link
OpenLDAP Link

4 comments:

Andreas said...

I think you have forgotten to configure the ldap client, or got M.I.A. while copy/pasting.

Greetings from Germany
Andreas

salahuddin66 said...

My project was a common addressbook for the
outlook express + thunderbird users.

Fırat NEMİŞ said...

I make everything what you wrote in here thanks but i can not found for outlook anythings ? How i can configure ldap addressbok for outlook ? Mozilla Thunderbird is okey but Microsoft Outlook 2007 it can not show anything ?

salahuddin66 said...

@Fırat NEMİŞ I have tested Microsoft Outlook 2000 as far I remember.

But it should work. This might help:
http://technet.microsoft.com/en-us/library/cc179232%28office.12%29.aspx