Here are the steps to build a very simple CA with OpenSSL, to be used with
OpenLDAP:
Disable private keys ciphering
OpenLDAP (AFAIK) needs private keys to be in cleartext. Copy the OpenSSL
CA.sh file in your working directory:
# cp /usr/lib/ssl/misc/CA.sh CA-nodes.sh
then modify it to add -nodes in the -newcert) and
-newreq) sections:
-newcert)
# create a certificate
$REQ -new -nodes -x509 -keyout newreq.pem -out newreq.pem $DAYS
RET=$?
echo "Certificate (and private key) is in newreq.pem"
;;
-newreq)
# create a certificate request
$REQ -new -nodes -keyout newreq.pem -out newreq.pem $DAYS
RET=$?
echo "Request (and private key) is in newreq.pem"
;;
Create the CA
# /usr/lib/ssl/misc/CA.sh -newca
Generate a server certificate request
# ./CA-nodes.sh -newreq
Be sure to choose the FQDN of your server as the common
name of the certificate, the one that will be used from client
applications.
Sign the certificate request
# ./CA-nodes.sh -sign
Use the newly created certificate files
The certificate authority file is ./demoCA/cacert.pem. The
server certificate file is newcert.pem. The server certificate key
file is newkey.pem.
# mkdir /etc/ldap/tls
# cp newcert.pem /etc/ldap/tls/slapd-cert.pem
# cp newkey.pem /etc/ldap/tls/slapd-key.pem
# cp ./demoCA/cacert.pem /etc/ldap/tls/
Modify OpenLDAP' slapd.conf file to have the following
lines:
TLSCACertificateFile /etc/ldap/tls/cacert.pem
TLSCertificateFile /etc/ldap/tls/slapd-cert.pem
TLSCertificateKeyFile /etc/ldap/tls/slapd-key.pem
You can then test your installation with:
ldapsearch -x -ZZ -h 'your_server_FQDN' -b '' -s base