6.2. SSL 証明書の変更
SSL 証明書を変更するには、インベントリーファイルを編集してインストーラーを実行します。インストーラーは、すべての Ansible Automation Platform コンポーネントが動作していることを確認します。インストーラーの実行には時間がかかる場合があります。
あるいは、SSL 証明書を手動で変更することもできます。こちらのほうが迅速ですが、自動確認は行われません。
Red Hat では、Ansible Automation Platform インスタンスに変更を加える際にはインストーラーを使用することを推奨しています。
6.2.1. 前提条件
- 中間認証局がある場合は、それをサーバー証明書に追加する必要があります。
- Automation Controller と Automation Hub は両方とも NGINX を使用するため、サーバー証明書は PEM 形式である必要があります。
- 正しい証明書の順序を使用してください。最初にサーバー証明書を指定し、その後に中間認証局を指定します。
詳細は、NGINX ドキュメントの SSL 証明書のセクション を参照してください。
6.2.2. インストーラーを使用した SSL 証明書と鍵の変更
次の手順では、インベントリーファイル内の SSL 証明書と鍵を変更する方法について説明します。
手順
- 新しい SSL 証明書と鍵を Ansible Automation Platform インストーラーに関連するパスにコピーします。
SSL 証明書と鍵の絶対パスをインベントリーファイルに追加します。これらの変数の設定に関するガイダンスについては、Red Hat Ansible Automation Platform インストールガイド の Automation Controller 変数 および Automation Hub 変数 のセクションを参照してください。
-
Automation Controller:
web_server_ssl_cert
、web_server_ssl_key
、custom_ca_cert
-
Automation Hub:
automationhub_ssl_cert
、automationhub_ssl_key
、custom_ca_cert
注記custom_ca_cert
は、中間認証局に署名したルート認証局である必要があります。このファイルは/etc/pki/ca-trust/source/anchors
にインストールされます。-
Automation Controller:
- インストーラーを実行します。
6.2.3. SSL 証明書の手動変更
6.2.3.1. Automation Controller での SSL 証明書と鍵の手動変更
次の手順では、Automation Controller で SSL 証明書と鍵を手動で変更する方法について説明します。
手順
現在の SSL 証明書をバックアップします。
cp /etc/tower/tower.cert /etc/tower/tower.cert-$(date +%F)
現在の鍵ファイルをバックアップします。
cp /etc/tower/tower.key /etc/tower/tower.key-$(date +%F)+
-
新しい SSL 証明書を
/etc/tower/tower.cert
にコピーします。 -
新しい鍵を
/etc/tower/tower.key
にコピーします。 SELinux コンテキストを復元します。
restorecon -v /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.key
NGINX 設定をテストします。
nginx -t
NGINX をリロードします。
systemctl reload nginx.service
新しい SSL 証明書と鍵がインストールされていることを確認します。
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443
6.2.3.2. OpenShift Container Platform 上の Automation Controller の SSL 証明書と鍵の変更
次の手順では、OpenShift Container Platform で実行されている Automation Controller の SSL 証明書と鍵を変更する方法について説明します。
手順
- 署名された SSL 証明書と鍵をセキュアな場所にコピーします。
OpenShift 内に TLS シークレットを作成します。
oc create secret tls ${CONTROLLER_INSTANCE}-certs-$(date +%F) --cert=/path/to/ssl.crt --key=/path/to/ssl.key
Automation Controller カスタムリソースを変更して、
route_tls_secret
と新しいシークレットの名前を spec セクションに追加します。oc edit automationcontroller/${CONTROLLER_INSTANCE}
... spec: route_tls_secret: automation-controller-certs-2023-04-06 ...
TLS シークレットの名前は任意です。この例では、Automation Controller インスタンスに適用される他の TLS シークレットと区別するために、シークレットを作成した日付のタイムスタンプが付けられています。
- 変更が適用されるまで数分待ちます。
新しい SSL 証明書と鍵がインストールされていることを確認します。
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443
6.2.3.3. Automation Hub での SSL 証明書と鍵の手動変更
次の手順では、Automation Hub で SSL 証明書と鍵を手動で変更する方法について説明します。
手順
現在の SSL 証明書をバックアップします。
cp /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.crt-$(date +%F)
現在の鍵ファイルをバックアップします。
cp /etc/pulp/certs/pulp_webserver.key /etc/pulp/certs/pulp_webserver.key-$(date +%F)
-
新しい SSL 証明書を
/etc/pulp/certs/pulp_webserver.crt
にコピーします。 -
新しい鍵を
/etc/pulp/certs/pulp_webserver.key
にコピーします。 SELinux コンテキストを復元します。
restorecon -v /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.key
chmod 0600 /etc/pulp/certs/pulp_webserver.crt /etc/pulp/certs/pulp_webserver.key
NGINX 設定をテストします。
nginx -t
NGINX をリロードします。
systemctl reload nginx.service
新しい SSL 証明書と鍵がインストールされていることを確認します。
true | openssl s_client -showcerts -connect ${CONTROLLER_FQDN}:443