Chapter 15. Configuring custom SSL/TLS certificates
You can configure the undercloud to use SSL/TLS for communication over public endpoints. However, if want to you use a SSL certificate with your own certificate authority, you must complete the following configuration steps.
15.1. Initializing the signing host Copy linkLink copied to clipboard!
The signing host is the host that generates and signs new certificates with a certificate authority. If you have never created SSL certificates on the chosen signing host, you might need to initialize the host so that it can sign new certificates.
Procedure
The
/etc/pki/CA/index.txtfile contains records of all signed certificates. Check if this file exists. If it does not exist, create an empty file:sudo touch /etc/pki/CA/index.txt
$ sudo touch /etc/pki/CA/index.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow The
/etc/pki/CA/serialfile identifies the next serial number to use for the next certificate to sign. Check if this file exists. If the file does not exist, create a new file with a new starting value:echo '1000' | sudo tee /etc/pki/CA/serial
$ echo '1000' | sudo tee /etc/pki/CA/serialCopy to Clipboard Copied! Toggle word wrap Toggle overflow
15.2. Creating a certificate authority Copy linkLink copied to clipboard!
Normally you sign your SSL/TLS certificates with an external certificate authority. In some situations, you might want to use your own certificate authority. For example, you might want to have an internal-only certificate authority.
Procedure
- Generate a key and certificate pair to act as the certificate authority:
openssl genrsa -out ca.key.pem 4096 openssl req -key ca.key.pem -new -x509 -days 7300 -extensions v3_ca -out ca.crt.pem
$ openssl genrsa -out ca.key.pem 4096
$ openssl req -key ca.key.pem -new -x509 -days 7300 -extensions v3_ca -out ca.crt.pem
-
The
openssl reqcommand asks for certain details about your authority. Enter these details at the prompt.
These commands create a certificate authority file called ca.crt.pem.
15.3. Adding the certificate authority to clients Copy linkLink copied to clipboard!
For any external clients aiming to communicate using SSL/TLS, copy the certificate authority file to each client that requires access to your Red Hat OpenStack Platform environment.
Procedure
Copy the certificate authority to the client system:
sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/Copy to Clipboard Copied! Toggle word wrap Toggle overflow After you copy the certificate authority file to each client, run the following command on each client to add the certificate to the certificate authority trust bundle:
sudo update-ca-trust extract
$ sudo update-ca-trust extractCopy to Clipboard Copied! Toggle word wrap Toggle overflow
15.4. Creating an SSL/TLS key Copy linkLink copied to clipboard!
Enabling SSL/TLS on an OpenStack environment requires an SSL/TLS key to generate your certificates. This procedure shows how to generate this key.
Procedure
Run the following command to generate the SSL/TLS key (
server.key.pem):openssl genrsa -out server.key.pem 2048
$ openssl genrsa -out server.key.pem 2048Copy to Clipboard Copied! Toggle word wrap Toggle overflow
15.5. Creating an SSL/TLS certificate signing request Copy linkLink copied to clipboard!
Complete the following procedure to create a certificate signing request.
Procedure
Copy the default OpenSSL configuration file:
cp /etc/pki/tls/openssl.cnf .
$ cp /etc/pki/tls/openssl.cnf .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the new
openssl.cnffile and configure the SSL parameters to use for the director. An example of the types of parameters to modify include:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
commonName_defaultto one of the following entries:-
If using an IP address to access the director over SSL/TLS, use the
undercloud_public_hostparameter inundercloud.conf. If using a fully qualified domain name to access the director over SSL/TLS, use the domain name.
Add
subjectAltName = @alt_namesto thev3_reqsection.Edit the
alt_namessection to include the following entries:-
IP- A list of IP addresses that clients use to access the director over SSL. -
DNS- A list of domain names that clients use to access the director over SSL. Also include the Public API IP address as a DNS entry at the end of thealt_namessection.
NoteFor more information about
openssl.cnf, run theman openssl.cnfcommand.-
If using an IP address to access the director over SSL/TLS, use the
Run the following command to generate a certificate signing request (
server.csr.pem):openssl req -config openssl.cnf -key server.key.pem -new -out server.csr.pem
$ openssl req -config openssl.cnf -key server.key.pem -new -out server.csr.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that you include your OpenStack SSL/TLS key with the
-keyoption.
This command results in an server.csr.pem file, which is the certificate signing request. Use this file to create your OpenStack SSL/TLS certificate.
15.6. Creating the SSL/TLS certificate Copy linkLink copied to clipboard!
This procedure shows how to generate the certificate for your OpenStack environment. This requires the following files:
openssl.cnf- The customized configuration file specifying the v3 extensions.
server.csr.pem- The certificate signing request to generate and sign the certificate with a certificate authority.
ca.crt.pem- The certificate authority, which signs the certificate.
ca.key.pem- The certificate authority private key.
Procedure
Run the following command to create a certificate for your undercloud or overcloud:
sudo openssl ca -config openssl.cnf -extensions v3_req -days 3650 -in server.csr.pem -out server.crt.pem -cert ca.crt.pem -keyfile ca.key.pem
$ sudo openssl ca -config openssl.cnf -extensions v3_req -days 3650 -in server.csr.pem -out server.crt.pem -cert ca.crt.pem -keyfile ca.key.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command uses the following options:
-config-
Use a custom configuration file, which is our
openssl.cnffile with v3 extensions. -extensions v3_req- Enabled v3 extensions.
-days- Defines how long in days until the certificate expires.
-in'- The certificate signing request.
-out- The resulting signed certificate.
-cert- The certificate authority file.
-keyfile- The certificate authority private key.
This command creates a new certificate named server.crt.pem. Use this certificate in conjunction with your OpenStack SSL/TLS key
15.7. Adding the certificate to the undercloud Copy linkLink copied to clipboard!
Complete the following steps to add your OpenStack SSL/TLS certificate to the undercloud trust bundle.
Procedure
Run the following command to combine the certificate and key:
cat server.crt.pem server.key.pem > undercloud.pem
$ cat server.crt.pem server.key.pem > undercloud.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command creates a
undercloud.pemfile.Copy the
undercloud.pemfile to a location within your/etc/pkidirectory and set the necessary SELinux context so that HAProxy can read it:sudo mkdir /etc/pki/undercloud-certs sudo cp ~/undercloud.pem /etc/pki/undercloud-certs/. sudo semanage fcontext -a -t etc_t "/etc/pki/undercloud-certs(/.*)?" sudo restorecon -R /etc/pki/undercloud-certs
$ sudo mkdir /etc/pki/undercloud-certs $ sudo cp ~/undercloud.pem /etc/pki/undercloud-certs/. $ sudo semanage fcontext -a -t etc_t "/etc/pki/undercloud-certs(/.*)?" $ sudo restorecon -R /etc/pki/undercloud-certsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the
undercloud.pemfile location to theundercloud_service_certificateoption in theundercloud.conffile:undercloud_service_certificate = /etc/pki/undercloud-certs/undercloud.pem
undercloud_service_certificate = /etc/pki/undercloud-certs/undercloud.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure you add the certificate authority that signed the certificate to the undercloud’s list of trusted Certificate Authorities so that different services within the undercloud have access to the certificate authority:
sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/ sudo update-ca-trust extract
$ sudo cp ca.crt.pem /etc/pki/ca-trust/source/anchors/ $ sudo update-ca-trust extractCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Continue installing the undercloud.