1.2. 管理 Ingress 証明書の置き換え
OpenShift のデフォルト Ingress 証明書を使用しない場合は、Red Hat Advanced Cluster Management for Kubernetes ルートを更新して、管理 Ingress 証明書を置き換えることができます。
1.2.1. 管理 Ingress 証明書を置き換えるための前提条件 リンクのコピーリンクがクリップボードにコピーされました!
management-ingress 証明書と秘密鍵を作成して準備します。必要に応じて、OpenSSL で TLS 証明書を生成できます。証明書のコモンネームパラメーター (CN) を manangement-ingress に設定します。証明書を生成する場合は、以下の設定を追加します。
証明書のサブジェクトの別名 (SAN) リストのドメイン名として Red Hat Advanced Cluster Management for Kubernetes のルート名を含めます。
以下のコマンドを実行してルート名を取得します。
oc get route -n open-cluster-management以下の応答が返される場合があります。
multicloud-console.apps.grchub2.dev08.red-chesterfield.com
1.2.1.1. 証明書を生成する設定ファイルの例 リンクのコピーリンクがクリップボードにコピーされました!
以下の設定ファイルおよび OpenSSL コマンドの例では、OpenSSL を使用して TLS 証明書を生成する方法を示しています。以下の csr.cnf 設定ファイルを確認してください。このファイルは、OpenSSL での証明書生成の設定設定を定義します。
[ req ] # Main settings
default_bits = 2048 # Default key size in bits.
prompt = no # Disables prompting for certificate values so the configuration file values are used.
default_md = sha256 # Specifies the digest algorithm.
req_extensions = req_ext # Specifies the configuration file section that includes any extensions.
distinguished_name = dn # Specifies the section that includes the distinguished name information.
[ dn ] # Distinguished name settings
C = US # Country
ST = North Carolina # State or province
L = Raleigh # Locality
O = Red Hat Open Shift # Organization
OU = Red Hat Advanced Container Management # Organizational unit
CN = management-ingress # Common name.
[ req_ext ] # Extensions
subjectAltName = @alt_names # Subject alternative names
[ alt_names ] # Subject alternative names
DNS.1 = multicloud-console.apps.grchub2.dev08.red-chesterfield.com
[ v3_ext ] # x509v3 extensions
authorityKeyIdentifier=keyid,issuer:always # Specifies the public key that corresponds to the private key that is used to sign a certificate.
basicConstraints=CA:FALSE # Indicates whether the certificate is a CA certificate during the certificate chain verification process.
#keyUsage=keyEncipherment,dataEncipherment # Defines the purpose of the key that is contained in the certificate.
extendedKeyUsage=serverAuth # Defines the purposes for which the public key can be used.
subjectAltName=@alt_names # Identifies the subject alternative names for the identify that is bound to the public key by the CA.
注記: 管理 Ingress の正しいホスト名を使用して SAN ラベルが付いた DNS.1 を必ず更新してください。
1.2.1.2. 証明書生成の OpenSSL コマンド リンクのコピーリンクがクリップボードにコピーされました!
以下の OpenSSL コマンドは、上記の設定ファイルと合わせて使用して、必要な TLS 証明書を生成します。
認証局 (CA) RSA 秘密鍵を生成します。
openssl genrsa -out ca.key 4096CA キーを使用して自己署名の CA 証明書を生成します。
openssl req -x509 -new -nodes -key ca.key -subj "/C=US/ST=North Carolina/L=Raleigh/O=Red Hat OpenShift" -days 400 -out ca.crt証明書の RSA 秘密鍵を生成します。
openssl genrsa -out ingress.key 4096秘密鍵を使用して証明書署名要求 (CSR) を生成します。
openssl req -new -key ingress.key -out ingress.csr -config csr.cnfCA 証明書、キー、および CSR を使用して署名済み証明書を生成します。
openssl x509 -req -in ingress.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out ingress.crt -sha256 -days 300 -extensions v3_ext -extfile csr.cnf証明書の内容を調べます。
openssl x509 -noout -text -in ./ingress.crt
1.2.2. 独自の Ingress 証明書の置き換え リンクのコピーリンクがクリップボードにコピーされました!
独自の Ingress 証明書を置き換えるには、以下の手順を実行します。
証明書および秘密鍵を使用して
byo-ingress-tlsシークレットを作成します。以下のコマンドを実行します。oc -n open-cluster-management create secret tls byo-ingress-tls-secret --cert ./ingress.crt --key ./ingress.key以下のコマンドでシークレットが正しい namespace に作成されていることを確認します。
oc get secret -n open-cluster-management | grep -e byo-ingress-tls-secret -e byo-ca-cert任意: 以下のコマンドを実行して、CA 証明書を含むシークレットを作成します。
oc -n open-cluster-management create secret tls byo-ca-cert --cert ./ca.crt --key ./ca.keyサブスクリプションを再デプロイするには、
management-ingressサブスクリプションを削除します。前の手順で作成したシークレットが自動的に使用されます。以下のコマンドを実行します。oc delete subscription management-ingress-sub -n open-cluster-management- 現在の証明書が、指定した証明書になっており、すべてのコンソールアクセスとログイン機能がそのまま維持されていることを確認します。
1.2.3. 管理 Ingress のデフォルト自己署名証明書の復元 リンクのコピーリンクがクリップボードにコピーされました!
次のコマンドで、独自の証明書のシークレットを削除します。
oc delete secret byo-ca-cert byo-ingress-tls-secret -n open-cluster-managementサブスクリプションを再デプロイするには、
management-ingressサブスクリプションを削除します。前の手順で作成したシークレットが自動的に使用されます。以下のコマンドを実行します。oc delete subscription management-ingress-sub -n open-cluster-management- 現在の証明書が、指定した証明書になっており、すべてのコンソールアクセスとログイン機能がそのまま維持されていることを確認します。
Red Hat Advanced Cluster Management で作成して管理する証明書の詳細は、証明書 を参照してください。クラスターのセキュリティー保護に関する詳細は、リスクおよびコンプライアンス ページに戻り、確認してください。