$Date: 2009/11/10 16:33:58 $
These are my notes in trying to figure out OpenSSL Public Key Infrastructure (PKI).
On the examples in Network Security with OpenSSL:
No matter if you are setting up a Certificate Authority (CA), or just setting up SSL for a web server, a private key is needed. This is the fundamental cryptographic requirement.
To generate an RSA key of 4096-bits length,
openssl genrsa -des3 -out my_private_key.pem 4096This private key file is then stored in an appropriate directory for the application you need. N.B. this key must never be exposed, so it should have permissions which allow only root to read it, and all write permissions removed, i.e. mode 0400.
openssl req -new -key /etc/pki/tls/private/my_private_key.pem \
-out my_request.pem -outform PEM
openssl ca -in somebodys_request.pem
The locations below are the defaults. These may be changed by modifying the configuration files for the individual services.
In Fedora, all CA-related files are located in
/etc/pki/CA/The private key file should be in
/etc/pki/CA/private/
Similarly, the TLS files are located in
/etc/pki/tls/and the private key should be in
/etc/pki/tls/private/The private key for the CA and for TLS should be different as they are conceptually different entities in the PKI.
The configuration files for httpd and slapd both have lines which define where the certificate for SSL is kept. Both httpd and slapd may use the same certificate, although this is not the default configuration.
The config file
/etc/openldap/slapd.confcontains lines which determine where the certificate file, the private key, and the CA bundle are located.
To start the LDAP server (slapd) with TLS enabled, edit the /etc/init.d/ldap script to include the line:
SLAPD_LDAPS="yes"
In order that not to have to enter the private key passphrase every time the httpd server starts up, you have to remove the passphrase from the private key. To do so:
cd /etc/pki/tls/private
openssl rsa -in my_private_key.pem -out my_private_key_nopass.pem
mv my_private_key_nopass.pem my_private_key.pem
The config file
/etc/httpd/conf.d/ssl.confcontains lines which determine where the certificate file, the private key, and the CA bundle are located. You may also do this on a per-virtual host basis.