The Register® — Biting the hand that feeds IT

Feeds

Build a directory service for web-based services

OpenLDAP for the people

Ensure Ease of Recovery with Asigra’s Agentless Software

Hands on A directory service is an application that lets you store, retrieve and modify information about network-attached resources such as users.

If you want to keep a directory of company employees, for example, you would use a directory service instead of storing that information directly in a database. A directory service is created in a directory server, which is built on top of the database.

Directory servers are equally useful online, for use in web-based services like social networks.

In this article I shall create a directory service using PHP, one of the internet's most popular scripting languages, and OpenLDAP directory server - part of the ubiquitous OpenLDAP suite used in Linux distributions and vendors' software.

I have picked OpenLDAP because it's an open source package, meaning the code is easy to grab and use, and because it's easier to install and use than commercial directory servers such as Oracle Internet Directory server or IBM's Tivoli directory server.

Get up to speed

First, some basic - but essential - orientation. As I mentioned, the actual user data is stored in a database - a directory service is an abstract layer that sits on top of the database.

Lightweight Directory Access Protocol (LDAP) is a lightweight protocol for accessing directory services and that also defines operations for adding, searching, modifying and deleting directory entries. A "directory entry" is a set of attributes identified by a globally unique Distinguished Name (DN). Each of a directory entry's attributes has a type and one or more values.

Some examples of attribute types are discussed in the following table:

Attribute Type Description
o Organization
dc Domain component
ou Organizational unit
cn Common name
uid Userid
dn Distinguished name
mail Email address

The attributes in a directory entry's DN are arranged in a hierarchy from right to left, with the right-most attributes as the base entry and the left-most attributes called Relative Distinguished Name (RDN). A DN is a sequence of RDNs. An example of a DN is as follows.

cn=dvohra,dc=example,dc=com

In this example, the base entry/root is dc=example,dc=com, and the RDN is cn=dvohra.

Ok, now let's get started. First, install Apache HTTP Server 2.3.2 and PHP 5.2. Enable the PHP LDAP extension in php.ini configuration file.

extension=php_ldap.dll

Requirements Checklist for Choosing a Cloud Backup and Recovery Service Provider

Next page: Install OpenLDAP

Latest Comments

RE:What benefits does the directory provide over direct DB access?

Also DBAs would be required to administer the database.

0
0

RE:What benefits does the directory provide over direct DB access?

If a directory is stored directly in a dataabse the directory information would have to be mapped to multiple databases. Also the directory service provides attributes, which facilitiate update and search of directory information. The alternative is using the WHERE cluases in SQL statements to update and search.

Please also refer "LDAP vs relational database", which is for OpenDS, but most of the advantages also apply to OpenLDAP. Both OpenDS and OpenLDAP directory servers are based on the embedded Berkeley DB database.

http://blogs.sun.com/treydrake/entry/ldap_vs_relational_database

0
0

RE:What benefits does the directory provide over direct DB access?

Please also refer

http://blogs.sun.com/treydrake/entry/ldap_vs_relational_database_part

http://www.linuxtopia.org/online_books//network_administration_guides/ldap_administration/intro_LDAP_vs_RDBMS.html

0
0

More from The Register

Bjarne Again: Hallelujah for C++
Plus: Now officially OK to admit you never used STL algorithms
Interwebs taunt Sir Jony over Apple eye candy makeover
Hey Ive, Ive... add more unicorns, willya?
SCO vs. IBM battle resumes over ownership of Unix
Zombie lawsuit back and wants to suck the brains out of Linux
Red Hat to ditch MySQL for MariaDB in RHEL 7
So long, Oracle! Don't let the door hit you on the way out
Shy? Socially inadequate? Fiddling with your phone could help
App 'tells the brutal truth' about social inadequates' chatup lines
Java EE 7 melds HTML5 with enterprise apps
New release arrives with GlassFish, NetBeans support
 breaking news
'Office Facebook' firm Tibbr wants you to PAY for mobe-meetings app
Great idea. Punters won't cough for it though
 breaking news
The only Waze is Google: Ad giant tipped to gobble map app 'for $1.3bn'
Pac-Man-satnav-ish upstart in bidding war with Apple, Facebook
 breaking news
PM Cameron calls for modern, programmable computers! (We think)
IT education musings to G8 chiefs to mystify IT industry
Apple at WWDC: Sleek new iOS, death of the big cats, pint-sized Mac Pro
CEO Cook: 'The biggest change to iOS since the introduction of the iPhone'