Configuring the LDAP Clients

In the last couple of sections we have focused exclusively on the SLAPD server. Now that the server is running we need to get the client configuration so that we can make test connections to the server.

Fortunately all of the OpenLDAP client programs share one common configuration file, ldap.conf, which is located in Ubuntu at /etc/ldap/ldap.conf (if you build from source, according to Appendix A, the default location for this file is /usr/local/etc/openldap/ldap.conf).

Other programs, such as those that use the OpenLDAP client libraries (like the PHP and Python LDAP APIs, may also use the ldap.conf file as a default location to retrieve basic configuration information.

The purpose of the ldap.conf file is two-fold:

The ldap.conf file has three different kinds of directive:

At this point we are only interested in the general settings. In later chapters, we will return to this file when configuring SSL/TLS and SASL.

Now, we need to look into a basic ldap.conf file. The ldap.conf file is located in the same directory as slapd.conf/etc/ldap/ (or /usr/local/etc/openldap/ if you built from source). We will now insert the LDAP client settings into that basic ldap.conf file:

Again, as with slapd.conf, lines that begin with a number sign (#) are treated as comments, and are ignored by the OpenLDAP client tools.

Next, we have directives:

The next two directives, SIZELIMIT and TIMELIMIT, indicate the upper limits on the number of records returned (SIZELIMIT) and the amount of time the client will wait for the server to respond (TIMELIMIT). Here we have set both to 0, a special value for these directives that indicates that there should be no limit.

The way that size and time limits are handled can be a little confusing. On the client side there are two ways of specifying these limits: through the ldap.conf configuration file (as we are doing here) and through command-line parameters (as we will see in the next chapter).

However, the SIZELIMIT and TIMELIMIT directives above are not exactly defaults in the usual sense of the word. They are the absolute upper limit that the client can request. With command-line arguments the client can specify lower time and size limits, and those lower numbers will be used. But if the client attempts to specify larger size or time limits, they will be ignored, and the values of SIZELIMIT and TIMELIMIT will be used instead.

But the story doesn't end here. The SLAPD server can also define size and time limits (with the limits, sizelimit and timelimit directives in slapd.conf). If a client specifies a limit higher than the server's, the server will ignore the client's limit and use its own. We will look more at setting server limits in Chapter 5.

Now we have a functioning ldap.conf file that will alleviate the need to specify these parameters on the command line.

The last thing we need to do in this chapter is to use an OpenLDAP client to test out the SLAPD server.