Feeds

Build a directory service for web-based services

OpenLDAP for the people

Boost IT visibility and business value

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

Boost IT visibility and business value

Next page: Install OpenLDAP

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Backing up Big Data
Solving backup challenges and “protect everything from everywhere,” as we move into the era of big data management and the adoption of BYOD.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.