Chapter 6. Renewing and changing the SSL/TLS certificates
If your current SSL/TLS certificates have expired or will expire soon, you can either renew or replace the SSL/TLS certificates used by Ansible Automation Platform.
You must renew the SSL/TLS certificates if you need to regenerate them with new information such as new hosts.
You must replace the SSL/TLS certificates if you want to use certificates signed by an internal certificate authority.
6.1. Container-based installations Copy linkLink copied to clipboard!
You can change the TLS certificates and keys for your container-based Ansible Automation Platform installation. This process involves a preparation step, either providing new custom certificates or deleting or moving the old certificates, followed by running the installation program.
6.1.1. Changing TLS certificates and keys using the installation program Copy linkLink copied to clipboard!
The following procedure describes how to update the TLS certificates and keys by using the installation program.
Procedure
To prepare the certificates and keys, choose one of the following methods:
To provide custom certificates - For each service that requires updated TLS certificates, copy the new certificates and keys to a path relative to the Ansible Automation Platform installer. Then update the inventory file variables with the absolute paths to the new files.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To generate new certificates - If you want the installation program to generate a new certificate for a service, delete or move the existing certificates and keys.
Expand Table 6.1. Certificate and key file paths per service Service Certificate file path Key file path Automation controller
~/aap/controller/etc/tower.cert~/aap/controller/etc/tower.keyEvent-Driven Ansible
~/aap/eda/etc/eda.cert~/aap/eda/etc/eda.keyPlatform gateway
~/aap/gateway/etc/gateway.cert~/aap/gateway/etc/gateway.keyAutomation hub
~/aap/hub/etc/pulp.cert~/aap/hub/etc/pulp.keyPostgreSQL
~/aap/postgresql/server.crt~/aap/postgresql/server.keyReceptor
~/aap/receptor/etc/receptor.crt~/aap/receptor/etc/receptor.keyRedis
~/aap/redis/server.crt~/aap/redis/server.key
After preparing your certificates, run the
installplaybook from your installation directory:ansible-playbook -i <inventory_file_name> ansible.containerized_installer.install
ansible-playbook -i <inventory_file_name> ansible.containerized_installer.installCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the new TLS certificates are in use by checking that the services are running and accessible. To do this, check a specific endpoint by using curl:
curl -vk https://<hostname_or_ip>:<port_number>/api/v2/
$ curl -vk https://<hostname_or_ip>:<port_number>/api/v2/
The output of this command gives details about the TLS handshake. Look for the following output to confirm the correct certificate is being used:
* SSL certificate verify OK
* SSL certificate verify OK
6.2. Operator-based installations Copy linkLink copied to clipboard!
6.2.1. 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.2. Changing the SSL certificate and key for automation hub on OpenShift Container Platform Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL certificate and key for automation hub 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 ${AUTOMATION_HUB_INSTANCE}-certs-$(date +%F) --cert=/path/to/ssl.crt --key=/path/to/ssl.keyoc create secret tls ${AUTOMATION_HUB_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 hub custom resource to add
route_tls_secretand the name of the new secret to the spec section.oc edit automationhub/${AUTOMATION_HUB_INSTANCE}oc edit automationhub/${AUTOMATION_HUB_INSTANCE}Copy to Clipboard Copied! Toggle word wrap Toggle overflow ... spec: route_tls_secret: automation-hub-certs-2023-04-06 ...
... spec: route_tls_secret: automation-hub-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 hub 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.3. RPM-based installations Copy linkLink copied to clipboard!
To renew or change SSL certificates for RPM-based installations, you can edit the inventory file and run the installation program. The installation program verifies that all Ansible Automation Platform components are working.
Alternatively, you can change the SSL certificates manually. This is quicker, but there is no automatic verification.
Red Hat recommends that you use the installation program to make changes to your Ansible Automation Platform deployment.
6.3.1. Renewing the self-signed SSL/TLS certificates Copy linkLink copied to clipboard!
The following steps regenerate new SSL/TLS certificates for all Ansible Automation Platform components.
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.
Verification
Validate the CA file and certificate file on Event-Driven Ansible controller:
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/ansible-automation-platform/eda/server.cert openssl s_client -connect <EDA_FQDN>:443
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/ansible-automation-platform/eda/server.cert openssl s_client -connect <EDA_FQDN>:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow Validate the CA file and certificate file on platform gateway:
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/ansible-automation-platform/gateway/gateway.cert openssl s_client -connect <GATEWAY_FQDN>:443
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/ansible-automation-platform/gateway/gateway.cert openssl s_client -connect <GATEWAY_FQDN>:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow Validate the CA file and certificate file on automation hub:
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/pulp/certs/pulp_webserver.crt openssl s_client -connect <HUB_FQDN>:443
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/pulp/certs/pulp_webserver.crt openssl s_client -connect <HUB_FQDN>:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow Validate the CA file and certificate file on automation controller:
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/tower/tower.cert openssl s_client -connect <CONTROLLER_FQDN>:443
openssl verify -CAfile ansible-automation-platform-managed-ca-cert.crt /etc/tower/tower.cert openssl s_client -connect <CONTROLLER_FQDN>:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow
6.3.2. Changing SSL/TLS certificates and keys using the installation program Copy linkLink copied to clipboard!
The following procedure describes how to change the SSL/TLS certificate and key in the inventory file.
Prerequisites
- The certificates must be in PEM format.
- If there is an intermediate certificate authority, you must append it to the server certificate.
- 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.
Procedure
- Copy the new SSL/TLS certificates and keys to a path relative to the Ansible Automation Platform installer.
Add the absolute paths of the SSL/TLS certificates and keys to the inventory file. Refer to Inventory file variables for guidance on setting these variables.
-
Event-Driven Ansible controller:
automationedacontroller_ssl_cert,automationedacontroller_ssl_key,custom_ca_cert -
Platform gateway:
automationgateway_ssl_cert,automationgateway_ssl_key,custom_ca_cert -
Automation hub:
automationhub_ssl_cert,automationhub_ssl_key,custom_ca_cert Automation controller:
web_server_ssl_cert,web_server_ssl_key,custom_ca_certNoteThe
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.
-
Event-Driven Ansible controller:
- Run the installation program.
6.3.3. Changing SSL/TLS certificates and keys manually Copy linkLink copied to clipboard!
The following procedure describes how to change SSL/TLS certificates and keys manually for all Ansible Automation Platform components.
Procedure
Backup the current SSL/TLS certificate:
cp <CERT_PATH> <CERT_PATH>-$(date +%F)
cp <CERT_PATH> <CERT_PATH>-$(date +%F)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Backup the current key files:
cp <KEY_PATH> <KEY_PATH>-$(date +%F)
cp <KEY_PATH> <KEY_PATH>-$(date +%F)Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Copy the new SSL/TLS certificate to the certificate path.
- Copy the new key to the key path.
Restore the SELinux context:
restorecon -v <CERT_PATH> <KEY_PATH>
restorecon -v <CERT_PATH> <KEY_PATH>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set appropriate permissions for the certificate and key files:
chown <OWNER>:<GROUP> <CERT_PATH> <KEY_PATH> chmod 0600 <CERT_PATH> <KEY_PATH>
chown <OWNER>:<GROUP> <CERT_PATH> <KEY_PATH> chmod 0600 <CERT_PATH> <KEY_PATH>Copy 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/TLS certificate and key have been installed:
true | openssl s_client -showcerts -connect <COMPONENT_FQDN>:443
true | openssl s_client -showcerts -connect <COMPONENT_FQDN>:443Copy to Clipboard Copied! Toggle word wrap Toggle overflow Expand Table 6.2. SSL/TLS certificate and key file paths per service Service Certificate file path Key file path Owner:Group Automation controller
/etc/tower/tower.cert/etc/tower/tower.keyroot:awxAutomation hub
/etc/pulp/certs/pulp_webserver.crt/etc/pulp/certs/pulp_webserver.keyroot:pulpEvent-Driven Ansible controller
/etc/ansible-automation-platform/eda/server.cert/etc/ansible-automation-platform/eda/server.keyroot:edaPlatform gateway
/etc/ansible-automation-platform/gateway/gateway.cert/etc/ansible-automation-platform/gateway/gateway.keyroot:gateway