Chapter 6. Renewing and changing the SSL certificate
If your current SSL certificate has expired or will expire soon, you can either renew or replace the SSL certificate used by Ansible Automation Platform.
You must renew the SSL certificate if you need to regenerate the SSL certificate with new information such as new hosts.
You must replace the SSL certificate if you want to use an SSL certificate signed by an internal certificate authority.
6.1. Renewing the self-signed SSL certificate Copy linkLink copied to clipboard!
The following steps regenerate a new SSL certificate for both automation controller and automation hub.
Procedure
Add
aap_service_regen_cert=trueto the inventory file in the[all:vars]section:[all:vars] aap_service_regen_cert=true
[all:vars] aap_service_regen_cert=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the installer.
6.2. Changing SSL certificates Copy linkLink copied to clipboard!
To change the SSL certificate, you can edit the inventory file and run the installer. The installer verifies that all Ansible Automation Platform components are working. The installer can take a long time to run.
Alternatively, you can change the SSL certificates manually. This is quicker, but there is no automatic verification.
Red Hat recommends that you use the installer to make changes to your Ansible Automation Platform instance.
6.2.1. Prerequisites Copy linkLink copied to clipboard!
- If there is an intermediate certificate authority, you must append it to the server certificate.
- Both automation controller and automation hub use NGINX so the server certificate must be in PEM format.
- Use the correct order for the certificates: The server certificate comes first, followed by the intermediate certificate authority.
For further information, see the ssl certificate section of the NGINX documentation.
6.2.2. Changing the SSL certificate and key using the installer Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL certificate and key in the inventory file.
Procedure
- Copy the new SSL certificates and keys to a path relative to the Ansible Automation Platform installer.
Add the absolute paths of the SSL certificates and keys to the inventory file. Refer to the Automation controller variables and Automation hub variables sections of the Red Hat Ansible Automation Platform Installation Guide for guidance on setting these variables.
-
Automation controller:
web_server_ssl_cert,web_server_ssl_key,custom_ca_cert -
Automation hub:
automationhub_ssl_cert,automationhub_ssl_key,custom_ca_cert
NoteThe
custom_ca_certmust be the root certificate authority that signed the intermediate certificate authority. This file is installed in/etc/pki/ca-trust/source/anchors.-
Automation controller:
- Run the installer.
6.2.3. Changing the SSL certificate manually Copy linkLink copied to clipboard!
6.2.3.1. Changing the SSL certificate and key manually on automation controller Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL certificate and key manually on Automation Controller.
Procedure
Backup the current SSL certificate:
cp /etc/tower/tower.cert /etc/tower/tower.cert-$(date +%F)
cp /etc/tower/tower.cert /etc/tower/tower.cert-$(date +%F)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Backup the current key files:
cp /etc/tower/tower.key /etc/tower/tower.key-$(date +%F)+
cp /etc/tower/tower.key /etc/tower/tower.key-$(date +%F)+Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the new SSL certificate to
/etc/tower/tower.cert. -
Copy the new key to
/etc/tower/tower.key. Restore the SELinux context:
restorecon -v /etc/tower/tower.cert /etc/tower/tower.key
restorecon -v /etc/tower/tower.cert /etc/tower/tower.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set appropriate permissions for the certificate and key files:
chown root:awx /etc/tower/tower.cert /etc/tower/tower.key chmod 0600 /etc/tower/tower.cert /etc/tower/tower.key
chown root:awx /etc/tower/tower.cert /etc/tower/tower.key chmod 0600 /etc/tower/tower.cert /etc/tower/tower.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Test the NGINX configuration:
nginx -t
nginx -tCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reload NGINX:
systemctl reload nginx.service
systemctl reload nginx.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that new SSL certificate and key have been installed:
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.3.2. Changing the SSL certificate and key on automation controller on OpenShift Container Platform Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL certificate and key for automation controller running on OpenShift Container Platform.
Procedure
- Copy the signed SSL certificate and key to a secure location.
Create a TLS secret within OpenShift:
oc create secret tls ${CONTROLLER_INSTANCE}-certs-$(date +%F) --cert=/path/to/ssl.crt --key=/path/to/ssl.keyoc create secret tls ${CONTROLLER_INSTANCE}-certs-$(date +%F) --cert=/path/to/ssl.crt --key=/path/to/ssl.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Modify the automation controller custom resource to add
route_tls_secretand the name of the new secret to the spec section.oc edit automationcontroller/${CONTROLLER_INSTANCE}oc edit automationcontroller/${CONTROLLER_INSTANCE}Copy to Clipboard Copied! Toggle word wrap Toggle overflow ... spec: route_tls_secret: automation-controller-certs-2023-04-06 ...
... spec: route_tls_secret: automation-controller-certs-2023-04-06 ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The name of the TLS secret is arbitrary. In this example, it is timestamped with the date that the secret is created, to differentiate it from other TLS secrets applied to the automation controller instance.
- Wait a few minutes for the changes to be applied.
Verify that new SSL certificate and key have been installed:
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.2.3.3. Changing the SSL certificate and key manually on automation hub Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL certificate and key manually on automation hub.
Procedure
Backup the current SSL certificate:
cp /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.crt-$(date +%F)
cp /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.crt-$(date +%F)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Backup the current key files:
cp /etc/pulp/certs/pulp_webserver.key /etc/pulp/certs/pulp_webserver.key-$(date +%F)
cp /etc/pulp/certs/pulp_webserver.key /etc/pulp/certs/pulp_webserver.key-$(date +%F)Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Copy the new SSL certificate to
/etc/pulp/certs/pulp_webserver.crt. -
Copy the new key to
/etc/pulp/certs/pulp_webserver.key. Restore the SELinux context:
restorecon -v /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.key
restorecon -v /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set appropriate permissions for the certificate and key files:
chown root:pulp /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.key
chown root:pulp /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow chmod 0600 /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.key
chmod 0600 /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow Test the NGINX configuration:
nginx -t
nginx -tCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reload NGINX:
systemctl reload nginx.service
systemctl reload nginx.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that new SSL certificate and key have been installed:
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow