1.2.3. 管理 Ingress 証明書の置き換え

管理 Ingress 証明書を置き換えることができます。OpenShift Container Platform のデフォルト Ingress 証明書を置き換える場合には、管理 Ingress を変更する必要があります。詳細は、「セキュリティーの既知の問題」の「コンソールへのログイン時の 500 内部エラー」を参照してください。

1.2.3.1. 管理 Ingress 証明書を置き換えるための前提条件

management-ingress 証明書と秘密鍵を作成して準備します。必要に応じて、OpenSSL で TLS 証明書を生成できます。証明書のコモンネームパラメーター (CN) を manangement-ingress に設定します。証明書を生成する場合は、以下の設定を追加します。

  • 証明書のサブジェクトの別名 (SAN: Subject Alternative Name) の一覧に以下の IP アドレスおよびドメイン名を含めます。

    • 管理 ingress のサービス名: management-ingress
    • Red Hat Advanced Cluster Management for Kubernetes の ルート名を含めます。以下のコマンドを実行してルート名を取得します。

      oc get route -n open-cluster-management

      以下の応答が返される場合があります。

      multicloud-console.apps.grchub2.dev08.red-chesterfield.com
    • ローカルホストの IP アドレス (127.0.0.1) を追加します。
    • ローカルホストのエントリー (localhost) を追加します。
1.2.3.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 = management-ingress
DNS.2 = multicloud-console.apps.grchub2.dev08.red-chesterfield.com
DNS.3 = localhost
DNS.4 = 127.0.0.1

[ 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.2 を必ず更新してください。

1.2.3.1.2. 証明書生成の OpenSSL コマンド

以下の OpenSSL コマンドは、上記の設定ファイルと合わせて使用して、必要な TLS 証明書を生成します。

  1. 認証局 (CA) RSA 秘密鍵を生成します。

    openssl genrsa -out ca.key 4096
  2. CA キーを使用して自己署名の 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
  3. 証明書の RSA 秘密鍵を生成します。

    openssl genrsa -out ingress.key 4096
  4. 秘密鍵を使用して証明書署名要求 (CSR) を生成します。

    openssl req -new -key ingress.key -out ingress.csr -config csr.cnf
  5. CA 証明書、キー、および 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
  6. 証明書の内容を調べます。

    openssl x509  -noout -text -in ./ingress.crt