B. OpenSSL Certificates For LDAP
Prev |  |

## B. OpenSSL Certificates For LDAP

If you are hosting two or more LDAP servers, you will probably not want to use self-signed certificates, since each client will have to be configured to work with each certificate. While this is possible, it is not nearly as simple as creating your own certificate authority, and signing your servers' certificates with that.

The steps here are presented as they are with very little attempt at explaining what is going on—further explanation can be found in openssl(1) and its friends.

To create a certificate authority, we simply need a self-signed certificate and key. The steps for this again are

Example B.1. Creating a certificate
`%` `openssl genrsa -out root.key 1024` `%` `openssl req -new -key root.key -out root.csr` `%` `openssl x509 -req -days 1024 -in root.csr -signkey root.key -out root.crt`

These will be your root CA key and certificate. You will probably want to encrypt the key and store it in a cool, dry place; anyone with access to it can masquerade as one of your LDAP servers.

Next, using the first two steps above create a key `ldap-server-one.key` and certificate signing request `ldap-server-one.csr`. Once you sign the signing request with `root.key`, you will be able to use `ldap-server-one.*` on your LDAP servers.

### Note:

Do not forget to use the fully qualified domain name for the “common name” attribute when generating the certificate signing request; otherwise clients will reject a connection with you, and it can be very tricky to diagnose.

To sign the key, use `-CA` and `-CAkey` instead of `-signkey`:

Example B.2. Signing as a certificate authority
`%` `openssl x509 -req -days 1024 \ -in ldap-server-one.csr -CA root.crt -CAkey root.key \ -out ldap-server-one.crt`

The resulting file will be the certificate that you can use on your LDAP servers.

Finally, for clients to trust all your servers, distribute `root.crt` (the certificate, not the key!) to each client, and specify it in the `TLSCACertificateFile` directive in `ldap.conf`.

Prev |  |
A. Useful Aids | Home |

This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.