4.2.8 サーバー証明書および信頼証明書の生成

OAAは通信にSSLを使用します。インストール前に、サーバー証明書および信頼証明書キーストア(PKCS12)を生成する必要があります。

証明書の生成にサード・パーティ認証局(CA)を使用するか、テスト目的で独自のCAおよび証明書を生成するかに応じて、次の関連する項に従います。

証明書を生成するためのサード・パーティCAの使用

  1. 管理コンテナのインストールを実行するノードで、ディレクトリを作成し、そのフォルダに移動します。次に例を示します:
    mkdir <workdir>/oaa_ssl
    export WORKDIR=<workdir>
    cd $WORKDIR/oaa_ssl
  2. サーバー証明書の4096ビット秘密キー(oaa.key) を生成します:
    openssl genrsa -out oaa.key 4096
  3. 証明書署名リクエスト(oaa.csr)を作成します:
    openssl req -new -key oaa.key -out oaa.csr
    求められた場合は、証明書署名リクエスト(CSR)作成の詳細を入力します。たとえば:
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [XX]:US
    State or Province Name (full name) []:California
    Locality Name (eg, city) [Default City]:Redwood City
    Organization Name (eg, company) [Default Company Ltd]:Example Company
    Organizational Unit Name (eg, section) []:Security
    Common Name (eg, your name or your server's hostname) []:oaa.example.com
    Email Address []:
    
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:
    An optional company name []:
  4. CSR (oaa.csr)をサード・パーティCAに送信します。
  5. CAから証明書を受信したら、ファイルの名前をoaa.pemに変更し、それを$WORKDIR/oaa_sslディレクトリにコピーします。

    ノート:

    証明書oaa.PEMはPEM形式である必要があります。PEM形式でない場合は、opensslを使用してPEMに変換します。たとえば、DER形式からPEMに変換するには:
    openssl x509 -inform der -in oaa.der -out oaa.pem
  6. 信頼ルートCA証明書(rootca.pem)と、oaa.pemに署名したチェーン内の他のCA証明書(rootca1.pemrootca2.pemなど)を、$WORKDIR/oaa_sslディレクトリにコピーします。前述のとおり、CA証明書はPEM形式である必要があるため、必要に応じて変換します。
  7. CAのチェーンに複数の証明書がある場合は、すべてのCA証明書を含むbundle.pemを作成します:
    cat rootca.pem rootca1.pem rootca2.pem >>bundle.pem
  8. 次のように、信頼証明書PKCS12ファイル(trust.p12)をファイルから作成します:
    openssl pkcs12 -export -out trust.p12 -nokeys -in bundle.pem
    求められた場合は、エクスポート・パスワードを入力して確認します。

    ノート:

    CAに証明書チェーンがない場合は、bundle.pemrootca.pemに置き換えます。
  9. 次のように、サーバー証明書PKCS12ファイル(cert.p12)を作成します:
    openssl pkcs12 -export -out cert.p12 -inkey oaa.key -in oaa.pem -chain -CAfile bundle.pem
    求められた場合は、エクスポート・パスワードを入力して確認します。

    ノート:

    CAに証明書チェーンがない場合は、bundle.pemrootca.pemに置き換えます。

ノート:

cert.p12およびtrust.p12へのパスは、後でinstallOAA.propertiesのパラメータcommon.local.sslcertおよびcommon.local.trustcertで使用されます。

テスト目的での独自のCAおよび証明書の生成

  1. 次のように、信頼証明書PKCS12ファイル(trust.p12)を作成します:
    1. 管理コンテナのインストールを実行するノードで、ディレクトリを作成し、そのフォルダに移動します。次に例を示します:
      mkdir <workdir>/oaa_ssl
      export WORKDIR=<workdir>
      cd $WORKDIR/oaa_ssl
    2. ルート認証局(CA)の4096ビットの秘密キーを生成します:
      openssl genrsa -out ca.key 4096
    3. 自己署名ルートCA証明書(ca.crt)を作成します:
      openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
      求められた場合は、CA作成の詳細を入力します。たとえば:
      You are about to be asked to enter information that will be incorporated
      into your certificate request.
      What you are about to enter is what is called a Distinguished Name or a DN.
      There are quite a few fields but you can leave some blank
      For some fields there will be a default value,
      If you enter '.', the field will be left blank.
      -----
      Country Name (2 letter code) [XX]:US
      State or Province Name (full name) []:California
      Locality Name (eg, city) [Default City]:Redwood City
      Organization Name (eg, company) [Default Company Ltd]:Example Company
      Organizational Unit Name (eg, section) []:Security
      Common Name (eg, your name or your server's hostname) []:OAA Certificate Authority
      Email Address []:
    4. CA証明書のPKCS12ファイルを生成します:
      openssl pkcs12 -export -out trust.p12 -nokeys -in ca.crt
      求められた場合は、エクスポート・パスワードを入力して確認します。
  2. 次のように、サーバー証明書PKCS12ファイル(cert.p12)を作成します:
    1. サーバー証明書の4096ビット秘密キー(oaa.key) を生成します:
      openssl genrsa -out oaa.key 4096
    2. 証明書署名リクエスト(cert.csr)を作成します:
      openssl req -new -key oaa.key -out cert.csr
      求められた場合は、証明書署名リクエスト(CSR)作成の詳細を入力します。たとえば:
      You are about to be asked to enter information that will be incorporated
      into your certificate request.
      What you are about to enter is what is called a Distinguished Name or a DN.
      There are quite a few fields but you can leave some blank
      For some fields there will be a default value,
      If you enter '.', the field will be left blank.
      -----
      Country Name (2 letter code) [XX]:US
      State or Province Name (full name) []:California
      Locality Name (eg, city) [Default City]:Redwood City
      Organization Name (eg, company) [Default Company Ltd]:Example Company
      Organizational Unit Name (eg, section) []:Security
      Common Name (eg, your name or your server's hostname) []:oaa.example.com
      Email Address []:
      
      Please enter the following 'extra' attributes
      to be sent with your certificate request
      A challenge password []:
      An optional company name []:
    3. 作成しておいたCAを使用して、CSRから証明書を生成します:
      openssl x509 -req -days 1826 -in cert.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out oaa.crt
    4. 秘密キーとサーバー証明書からPKCS12ファイル(cert.p12)を生成します:
      openssl pkcs12 -export -out cert.p12 -inkey oaa.key -in oaa.crt -chain -CAfile ca.crt
      求められた場合は、エクスポート・パスワードを入力して確認します。

ノート:

cert.p12およびtrust.p12へのパスは、後でinstallOAA.propertiesのパラメータcommon.local.sslcertおよびcommon.local.trustcertで使用されます。