Securing LDAP Through TLS/SSL: A Cookbook
- Setting Up the Directory Server and the Certificate Server
- Generating an SSL Server Certificate
- Generating an SSL Client Certificate
- Setting Up the Appropriate Trust Relations
- Enabling SSL for the Sun ONE Directory Server Software
- Setting Up LDAP/SSL Server Authentication
- Setting Up LDAP/SSL Client Authentication
- Successful and Secure Installation
Deploying secure Lightweight Directory Access Protocol (LDAP) connections is becoming more demanding as companies choose to build up and maintain a central repository. This article details the steps on how to set up the SunTM Open Net Environment (SunTM ONE) and the SunTM ONE Directory Server software so that it can be accessed securely from command line tools (for example, ldapadd, ldapmodify, or ldapsearch). More precisely, this article describes how client and server authentication can be accomplished with the Sun ONE platform products. In this article, security is accomplished two ways:
Transport Layer Security (TLS)/Secure Socket Layer (SSL) Protocolwhich provides a mechanism for ensuring the integrity and confidentiality of the transferred data.
Authentication based on SSL certificateswhich is used to guarantee the identity of the data sources.
This cookbook has been tested with the following products and releases:
SolarisTM 8 Operating Environment (updates 07/01, 10/01, and 02/02). Be sure to install the latest patch cluster.
Sun ONE Directory Server software (the document has been tested with versions 5.0 and 5.1)
The Public Key Cryptographic Standard (PKCS#11) toolkit (the current version is cpkg106.zip)
If you do not have access to a certificate authority (CA) for getting an SSL client and server certificates, you can use the SunTM ONE Certificate Server software (or the publicly available certutil tool). This article uses the Sun ONE Certificate Server software.
The basic steps for securing LDAP with SSL using your own CA are:
Setting up the Directory Server and the Certificate Server (CS).
Generating an SSL server certificate.
Generating an SSL client certificate.
Setting up the appropriate trust-relations.
Enabling SSL for the Sun ONE Directory Server software.
Setting up LDAP/SSL server authentication.
Setting up LDAP/SSL client authentication.
For this article, it is assumed that you have a basic understanding of how certificate-based public-key-cryptography works. Because the certificates are bound to the owner's name, the fictional business of iNIT8 was created for this article. iNIT8 uses the Sun ONE Directory Server Console to set up secure LDAP connections.
All iPlanet products have been rebranded as Sun ONE platform products.
Setting Up the Directory Server and the Certificate Server
You can install both the Sun ONE Directory Server software and the Sun ONE Certificate Server software on the same machine. In production environments, for security reasons, the Sun ONE Certificate Server software is installed on a different machine. The Sun ONE Certificate Server software comes bundled with its own directory server, which holds specific data and can reside on a separate machine depending on your deployment. For the sake of simplicity in this article, all three servers, Sun ONE Directory Server software, Sun ONE Certificate Server software, and the certificate server-specific directory server are installed on the same machine.
In our example, the installation parameters for the Sun ONE Certificate Server software and the bundled directory server are as follows:
Software: certificate-4.2-domestic-us.sparc-sun-solaris2.6.tar.gz Install location: /opt/iplanet/server4 Directory Service Port: 400 Directory Administration Port: 4000 Computer Name: sunshine.init8.net Directory Server Identifier: sunshine Administrator ID: admin Password: manager Directory Manager: cn=Directory Manager Password: dirmanager Suffix: o=init8.net
This installation procedure offers you the option to run the Sun ONE software servers under UID nobody and GID nobody. As an even better security practice, pick a unique user/group ID, for example, ldap or cert.
The Sun ONE Directory Server software has the following installation parameters:
Software: directory-5.1-us.sparc-sun-solaris2.8.tar.gz Install location: /opt/iplanet/server5 Directory Service Port: 389 Directory Administration Port: 3890 Computer Name: sunshine.init8.net Directory Server Identifier: sunshine Administrator ID: admin Password: manager Directory Manager: cn=Directory Manager Password: dirmanager Suffix: o=iNIT8.net
The suffix o=init8.net in the Sun ONE Directory Server software installation parameters is necessary. Do not use the dc=init8, dc=net suffix. It prevents the mapping defined in the section , "Setting Up LDAP/SSL Client Authentication" from working.
If you already have deployed a Certificate Server, you can skip this section.
Three certificates are needed for setting up a Certificate Authority (CA):
CA certificate (freshly generated during setup) to sign SSL certificates
SSL server certificate for the Certificate Server to communicate through the browser and SSL with the Certificate Server
SSL client certificate for the Certificate Server administrator (CS administrator).
The SSL client certificate is needed in order to authenticate yourself not only through username/password but by using a public-key method against the Certificate Server.
To Set Up the Certificate Server
Go to /opt/iplanet/server4 and execute startconsole.
Connect to your host at http://sunshine.init8.net:4000 with user ID admin and the password selected during the installation (for example, manager).
In init8.net you will see sunshine.init8.net and its group of three servers: Certificate Server (cert-sunshine), Administration Server, and Directory Server.
Double-click the Certificate Server (cert-sunshine).
The Certificate Server realizes that this is your first access and automatically starts up an installation wizard. Do the following:
Create a new internal database:
Instance ID: sunshine-db Port Number: 38900 Directory Manager DN: cn=Directory Manager Password: manager1
The wizard now creates a new internal database.
Add the following information about the administrator:
Administrator ID: admin Full Name: iNIT 8 Certificate Management System Administrator Password: manager1
Select the subsystem by choosing the Certificate Manager
Answering No to the question of whether you want to generate the issuance of Wireless Transportation Layer Security (wTLS) certificates.
Answer No to the question of whether you want the current subsystems to connect to a remote data recovery manager.
The system now configures the internal database.
Select the range of certificates (for example, 0x1 to 0x200).
(Optional) Enable the Online Certificate Status Protocol (OSCP) service.
Select the ports Sun ONE Certificate Server software will use:
SSL administration port: 8200 SSL agent port: 8100 SSL end entity port: 443 Non-SSL end-entity port: 80 (check enable)
Create a self-signed CA certificate:
Token: internal Password: manager1 Key type: RSA Key length: 1024 bits.
The system initializes the token.
Select SHA-1 as cryptographic hash algorithm.
Enter the values for the subject Distinguished Name (DN) components of the CA signing certificate.
This should be done according to your needs. For this example choose the following:
CN= iNIT8 Certificate Manager OU= CERT O= iNIT8 L= Hamburg ST= HAMBURG C= DE
Choose a validity period (for example, two years).
Activate the following extensions:
CA (Basic Constraints) S/MIME CA (Netscape certificate type) SSL CA (Netscape certificate type) Object-signing CA (Netscape certificate type) Authority key identifier Subject key identifier Key usage
Sign the SSL certificate with your CA signing certificate by choosing the corresponding option in the dialog window.
Choose an internal token and RSA, 1024 Bit. Click Next.
Select SHA-1 as hash algorithm. Click Next.
Enter the following values for the subject DN components:
CN= sunshine.init8.net OU= LDAP SSL O= iNIT8 L= Hamburg ST= HAMBURG C= DE
Select a validity period.
Select the following extensions:
SSL client (Netscape certificate type) SSL server (Netscape certificate type) Authority key identifier Key usage
The wizard now generates the certificate.
Select a single sign-on password (for example, manager1).
The system now creates a single sign-on database.
The CS administrator role is used to approve certificate requests.
Accept the server certificate.
If you are not automatically directed to the enrollment page, go to https://sunshine.init8.net:8100/ca/adminEnroll.html. You are challenged with a form. Provide the following necessary information:
User ID: admin Password: manager1 Full Name: iNIT8 CS administrator Login Name: admin E-Mail: firstname.lastname@example.org Organizational Unit: iNIT8 CS Organization: iNIT8 Country: DE Validity: 1 year Key length: 1024 Bit
The Certificate Server now instructs your browser to generate a new key pair. If this is the first key pair to be generated in this browser, you are asked for a password to protect the Communicator's Certificate Database. The certificate database is a file which resides in ~/.netscape/cert.db7. In order to protect this file, the data stored in the file is encrypted (this is similar to an encrypted SSH key file).
A new certificate is now displayed of which following is a partial example:
Certificate: Data: Version: v3 Serial Number: 0x4 Signature Algorithm: SHA1withRSA - 1.2.840.1135188.8.131.52 Issuer: CN=iNIT8 Certificate Manager, OU=CERT, O=iNIT8,L=Hamburg, ST=HAMBURG,C=DE Validity: Not Before: Monday, December 17, 2001 9:43:40 PM GMT+00:00 Not After: Tuesday, December 17, 2002 9:43:40 PM GMT+00:00 Subject: Eemail@example.com,CN=iNIT8 CS Administrator,UID=admin,OU=iNIT8 CS,O=iNIT8,C=DE Subject Public Key Info: Algorithm: RSA - 1.2.840.1135184.108.40.206 Public Key: Exponent: 65537 Public Key Modulus: (1024 bits) : D6:B6:16:70:ED:89:BC:C5:4E:71:1D:BA:F0:04:81:48: Extensions: Identifier: Netscape Certificate Type - 2.16.840.1.113730.1.1 Critical: no Certificate Usage: SSL Client Identifier: Key Usage: - 220.127.116.11 Critical: yes Key Usage: Digital Signature Non Repudiation Key Encipherment Identifier: Authority Key Identifier - 18.104.22.168 Critical: no Key Identifier: 04:34:FB:D9:41:55:36:8D:6D:C1:5A:73:A8:21:53:A8: F8:F2:C9:06 Signature: Algorithm: SHA1withRSA - 1.2.840.113522.214.171.124 Signature: CA:7F:7A:2E:6C:29:9C:9A:CA:07:B1:27:27:26:A4:D1: Base 64 encoded certificate -----BEGIN CERTIFICATE----- MIICvjCCAiegAwIBAgIBBDANBgkqhkiG9w0BAQUFADB0MQswCQYDVQQGEwJERTEQ -----END CERTIFICATE-----
Check the certificate in the browser: Communicator—Tools—Security Info—Certificates—Yours.
This browser holds a certificate for iNIT8 CS Administrator's iNIT8 ID. If you try to verify the certificate, you will notice that it is not trusted, because the signing certificate, iNIT8 Certificate Manager, is not trusted (this certificate resides in the Signers class). See the section , "Setting Up the Appropriate Trust Relations" for details on how to modify the trust relationship using the shell tool certutil. You now have everything you need in order to apply and approve certificates for an SSL-secured LDAP transmission.
Exit the Netscape_ console in the Sun ONE Certificate Server software directory /opt/iplanet/server4.