Software:
X/Motif
ansi xterm
grabc
mdgclock
miv
mplaymidi
mppp
mxascii
mcmap
mxcmap
mxconsole
mxkill
mxshowfont
qtip
xmastm
yrolo
Web
mhttpd
web counter
upload.pl
TimeTrack.pl
mod_auth_ldap
Games
fltkmm
Java
cdcl
jdgclock
Libraries
libcalen
libmcfg
libsll
libmsock
Misc
bangla font
dpr
genmake
hod
smtp.pl
vhtml
phones_ldap
showpic_ldap
mbasecalc
fluid_hack
kdialppp
MS Windows
mbasecalc
mailsend
wiv
|
(back to mod_auth_ldap page)
Created:
|
Feb-03-2003 (as part of
mod_auth_ldap documentation)
|
Last Updated:
|
Feb-03-2003
|
Table of Contents
Introduction
This document describes how to configure and use SSL/TLS with the LDAP
authentication module for Apache 2.
Using SSL for encryption
The module uses API from Netscape or iPlanet C SDK 5.08
to do SSL. To use SSL, you need the certificate database file comes with
netscape 4.x
browser. The reason you need certificate database from
netscape 4.x
browser is that the LDAP API uses this database for certificate
authorities' (CA) certificate.
netscape 4.x keeps the certificate of certificate
authorities (CA) in the file cert7.db file. This database is platform
independent.
To view the list, start
netscape 4.x and click on the lock icon. A window will
pop, click on the Signers. If the certificate you're using in your LDAP server
is from one of the CAs in the list, you can use the cert7.db with the
module for SSL. If you are using your own self signed certificate with your
LDAP server, you can insert your self signed certificate in this database.
Please look at the section
How to use self signed certificate for SSL.
To configure SSL for the module, do the following:
- Start netscape 4.x browser. (Please don't ask me where to get it)
- Find the files cert7.db and key3.db. In Linux/Unix,
the files are in $HOME/.netscape directory.
- Copy them to a directory say /usr/local/ssl. Note: as the files
are platform independent, you can use them in Windows as well.
(Note: I supplied cert7.db and key3.db files from Netscape
Communicator 4.75 for your convenience)
- Specify the path of the db files to the module with directive:
LDAP_CertDbDir
Example:
LDAP_CertDbDir /usr/local/ssl
# in Windows
LDAP_CertDbDir c:/usr/local/ssl
|
-
Specify the LDAP server's SSL port to the module. You must specify that.
Example:
- Start Apache. Make sure module is loaded correctly.
- Verify that SSL is working with your LDAP server. Use the tool
ldapsearch comes with
iPlanet C SDK 5.08 or
iPlanet Directory Server.
Example:
$ ldapsearch -Z -h ldap.muquit.com -b "o=muquit.com" \
-P /usr/local/ssl "uid=muquit"
|
If the above command works, the module will work as well.
If CA certificate in cert7.db is not
trusted by your LDAP server, the error message will look like:
ldap_search: Can't contact LDAP server
SSL error -8172 (Peer's certificate issuer has been marked as not trusted by the user.)
|
Turn debugging on with the directive
LDAP_Debug On and
watch the Apache's error_log to make sure SSL is used.
How to use self signed certificate for SSL
If you're using
iPlanet Directory Server
and want to use encryption but don't have certificate from one of the
certificate authorities in cert7.db, this document is for you.
We'll use OpenSSL to create certificates.
Please follow the steps:
- Install
OpenSSL.
We'll use the
tool
CA.sh from
OpenSSL. It's in the
apps directory.
- At the shell prompt, type:
$ mkdir my_ca
$ cd my_ca
$ CA.sh -newca
A example session is shown below:
$ CA.sh -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Using configuration from /opt1/users/mmuquit/openssl/ssl/openssl.cnf
Generating a 1024 bit RSA private key
....................++++++
.......................++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Pennsylvania
Locality Name (eg, city) []:Philadelphia
Organization Name (eg, company) [Internet Widgits Pty Ltd]:muquit.com
Organizational Unit Name (eg, section) []:ca
Common Name (eg, YOUR name) []:muquit.com
Email Address []:muquit@muquit.com
|
The file
cacert.pem
inside the directory
demoCA is the self signed
certificate. This certificate will be used to sign the certificate request
of the ldap server. You can look at the certificate by running the command:
$ openssl x509 -inform PEM -text < ./demoCA/cacert.pem
|
- Generate the certificate request for the
iPlanet Directory Server.
Follow the iPlanet directory administration guide for instruction on how
to generate the certificate request.
Copy the certificate request in the file
newreq.pem
in the my_ca directory.
Run the command
CA.sh -sign
to sign the certificate. Here's an example session:
$ CA.sh -sign
Using configuration from /opt1/users/mmuquit/openssl/ssl/openssl.cnf
Enter PEM pass phrase:
Check that the request matches the signature
Signature ok
The Subjects Distinguished Name is as follows
countryName :PRINTABLE:'US'
stateOrProvinceName :PRINTABLE:'Pennsylvania'
localityName :PRINTABLE:'Philadelphia'
organizationName :PRINTABLE:'Example Inc.'
organizationalUnitName:PRINTABLE:'Software Dev'
commonName :PRINTABLE:'ldap.example.com'
Certificate is to be certified until Dec 26 20:17:30 2003 GMT (365 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
....
|
The file
newcert.pem is the signed certificate.
Please follow the iPlanet directory administration guide for instruction on how
to install the certificate. From the file
newcert.pem copy the section from
-----BEGIN CERTIFICATE----- and
-----END CERTIFICATE----- and use it as certificate in the
text area of the iPlanet console.
- Follow the iPlanet directory administration guide to install the
CA certificate
cacert.pem as a
trusted CA certificate.
- Incert the
cacert.pem in
cert7.db . There're two ways it
can be done:
Using TLS for encryption
At this time only OpenLDAP SDK and Server supports TLS. That means TLS
will work if you compile the module with OpenLDAP C SDK with TLS support
and your OpenLDAP LDAP server is complied with TLS and configured to support
the same.
To start encrypted session with your OpenLDAP server, you do need to configure
anything in the module. Just use the
LDAP_StartTLS On
Note: the supplied Windows DLL does not have TLS support.
LDAP_StartTLS On or Off
If set the On, it will allow the module to start encrypted session with
the LDAP server provided the server has support for TLS and configured to
support TLS.
Note: I personally did not test this as I don't have openldap server
compiled and configured with TLS support.
Copyright
Copyright © 2003 Muhammad A Muquit, muquit@muquit.com.
URL of this page:http://www.muquit.com/muquit/software/mod_auth_ldap/ssl_tls.html
|