|
Running OpenLDAP server on Red Hat Linux 9
IntroductionThis page describes how to set up an LDAP server running on Linux. It is based on the Sybex publishers 2 cd edition of Red Hat Linux 9.0. There may be slight differences compared to the Red Hat 3 cd edition. Red Hat Linux 9, like some of the earlier versions, includes in the software bundle a version of OpenLDAP, packaged as an RPM file. OpenLDAP does not appear as an option when installing Red Hat Linux, but it can be easily installed later.
Introduction to LDAPStrictly speaking, LDAP is a protocol - Lightweight Directory Access Protocol - and is designed as a means of accessing directories based on X500. However the term LDAP is often used to refer to a directory - and I am afraid that this bad practice is used on this webpage, which describes the setting up of a directory service, rather than a description of the protocol.
InstallationThe OpenLDAP package is on CD 2, in the folder /RedHat/RPMS. At the command line, after mounting the cdrom, the installation instructions are
The installation sets up the ldap server configuration files in a folder /etc/openldap. The daemons are installed in /usr/sbin - there are two daemons installed :-
Various other files are installed, as well, but I can`t provide a definitive list. In Red Hat Linux, the LDAP server can be started with the command :-
and it can then be seen running as a process. However there is no point in running it until the directory has some information in it.
Configuring OpenLDAPTo configure a stand-alone LDAP server, the file "slapd.conf" needs to be modified - in its default state, it contains various settings which are really only examples of possible settings.
All the above is a fairly minimal configuration, and is unlikely to be sufficient for a live LDAP server - however it will produce a working server.
Adding some dataTo add data, an LDAP client is used - for this webpage, the client to be used is the "ldapadd" tool. An LDAP client is not installed on Red Hat Linux 9, either as part of the standard installation of Linux, or when the OpenLDAP server is installed - so it is neccessary to install it. The client is, like the server rpm file, on CD 2 of the Sybex set. The instructions are, as before,
The "ldapadd" tool uses ldif files to input data - so as a start, an ldif file is created using a text editor. I haven`t found this in any documentation, but it appears to be neccessary to define the domain component into which subsequent data is to be placed, even though this has already been defined throught the suffix line in the slapd.conf file. So the first ldif file contains :-
So type these lines into a new text file, then save it, any title will do, but use ".ldif" as the file extension - I have used "no-1.ldif" as the file name. The directory into which it is saved is up to you, I used "/etc/openldap/data/" for convenience. To put this data into the database, the "ldapadd" command is used. There are several options for this command, use "man ldapadd" to get the full list. I used the following command :-
I have wrapped the text to fit into a browser window, in reality it is all one line. You will be asked for the ldap password - this is the password specified in the slapd.conf file, associated with the rootdn name ( ie, the rootpw line ). If the data has been added, you will get the message
Having done that, it is now possible to add other entries - an entry is all the data associated with one particular object, such as a person. So to add a person to the database, the next ldif file could look like :-
Using the ldapsearch command enables you to check that the data has been added to the database :-
Again, there are a lot of options which can be used with the ldapsearch command, use the man pages to view them. However the above string should provide a read-out of the data in the database.
An explanation of the dataThis is a simple explanation of some of the expressions in the data :-
These two items are known as attributes - there are hundreds of different kinds of attributes, however only quite a small number can be attached to any particular kind of object.
Expanding the dataIf now it is wanted to expand the data stored about a person, for example, to store an e-mail address, it is neccessary to use an attribute which stores the e-mail address. However the "person" objectClass does not include an e-mail attribute as an allowable attribute, so it is neccessary to add another objectClass - the one required is the "inetOrgPerson" objectClass. The "inetOrgPerson" objectClass has some 27 attributes in its group, including the e-mail attribute, which somewhat confusingly, is called "mail". So now the ldif file looks like :-
The information about what attributes can be used with each objectClass is contained within the schema for the ldap server - the schema is defined by a number of files in /etc/openldap/schema/, which have the file extension schema. The .schema files that are used by any particular openldap server are defined in the slapd.conf file, as previously described. In Red Hat Linux 9, the default version of the slapd.conf has the schema defined in lines 6 to 12. Some attributes can have more than one value - in which case there is a second or subsequent line put into the .ldif file - for example, if Jo Nobody has a nickname such as "jono", the .ldif file becomes :-
Using the LDAP serviceThere are several applications that are LDAP aware. As an example, here is how to set up Microsoft Outlook Express to use the server just set up.
To do a search,
Finally .....There is a lot more to LDAP and to OpenLDAP than what is contained in this webpage - this is only a basic introduction to the version of OpenLDAP bundled with Red Hat Linux 9. There is plenty of information available from the internet about LDAP, and the site www.openldap.org contains a host of documentation about OpenLDAP.
© 2003 Ron Turner Return to the Index page
|
|