このドキュメントで説明するソフトウェアは、Extended SupportまたはSustaining Supportのいずれかにあります。 詳細は、https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdfを参照してください。
Oracleでは、このドキュメントに記載されているソフトウェアをできるだけ早くアップグレードすることをお薦めします。

機械翻訳について

23.4.4 自己署名CA証明書の作成および配布

LDAPで使用可能な、組織内のみで使用する証明書を作成できます。 適切な証明書を作成するには、次の例のように複数の方法があります。

  • 自己署名CA証明書とともに、秘密キーファイルを作成します。

  • 自己署名ルートCA証明書と秘密キー・ファイルを作成し、そのCA証明書とキー・ファイルを使用して、各サーバーの個々のサーバー証明書に署名します。

次に、opensslを使用して自己署名CA証明書と秘密キーファイルを作成し、これらのファイルを使用してサーバー証明書に署名する手順を説明します。

CA証明書を作成し、その証明書を使用してサーバー証明書に署名するには:

  1. ディレクトリをLDAPサーバーの/etc/openldap/certsに変更します。

    # cd /etc/openldap/certs
  2. CA証明書に対する秘密キーファイルCAcert-key.pemを作成します。

    # openssl genrsa -out CAcert-key.pem 1024
    Generating RSA private key, 1024 bit long modulus
    ......++++++
    ....++++++
    e is 65537 (0x10001)
  3. キー・ファイルのモードを0400に変更します。

    # chmod 0400 CAcert-key.pem
  4. 証明書リクエストCAcert.csrを作成します。

    # openssl req -new -key CAcert-key.pem -out CAcert.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]:Mydom Inc
    Organizational Unit Name (eg, section) []:Org
    Common Name (eg, your name or your server's hostname) []:www.mydom.org
    Email Address []:root@mydom.org
    
    Please enter the following 'extra' attributes
    to be sent with your certificate request
    A challenge password []:<Enter>
    An optional company name []:<Enter>
  5. 約3年間有効なCA証明書を作成します。

    # openssl x509 -req -days 1095 -in CAcert.csr -signkey CAcert-key.pem -out CAcert.pem
    rt-key.pem -out CAcert.pem
    Signature ok
    subject=/C=US/ST=California/L=Redwood City/O=Mydom 
    Inc/OU=Org/CN=www.mydom.org/emailAddress=root@mydom.org
    Getting Private key
  6. 作成するサーバー証明書ごとに、次のようにします。

    1. サーバー証明書に対する秘密キーを作成します。

      # openssl genrsa -out server-key.pem 1024
      Generating RSA private key, 1024 bit long modulus
      .............++++++
      ...........................++++++
      e is 65537 (0x10001)
      ノート

      複数のサーバーのサーバー証明書を生成する場合は、サーバーとサービスを簡単に識別できるように、証明書、そのキー・ファイルおよび証明書リクエストの名前をldap_host02-cert.pemldap_host02-key.pemldap_host02-cert.csrのように指定します。

    2. キー・ファイルのモードを0400に変更し、そのユーザーおよびグループの所有権をldapに変更します。

      # chmod 0400 server-key.pem
      # chown ldap:ldap server-key.pem
    3. 証明書リクエストserver-cert.csrを作成します。

      # openssl req -new -key server-key.pem -out server-cert.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]:Mydom Inc
      Organizational Unit Name (eg, section) []:Org
      Common Name (eg, your name or your server's hostname) []:ldap.mydom.com
      Email Address []:root@mydom.com
      
      Please enter the following 'extra' attributes
      to be sent with your certificate request
      A challenge password []:<Enter>
      An optional company name []:<Enter>
      ノート

      Common Name (共通名)には、サーバーの完全修飾ドメイン名(FQDN)を指定します。 サーバーのFQDNが証明書で指定されているCommon Name (共通名)と一致しない場合、クライアントはサーバーへの接続を取得できません。

    4. CA証明書と対応するキー・ファイルを使用して証明書リクエストに署名し、サーバーの証明書を生成します。

      # openssl x509 -req -days 1095 -CAcreateserial \
        -in server-cert.csr -CA CAcert.pem -CAkey CAcert-key.pem \
        -out server-cert.pem
      Signature ok
      subject=/C=US/ST=California/L=Redwood City/O=Mydom 
      Inc/OU=Org/CN=ldap.mydom.com/emailAddress=root@mydom.com
      Getting CA Private Key
  7. 他のLDAPサーバーのサーバー証明書を生成する場合は、適切なサーバー証明書、対応するキー・ファイルおよびCA証明書をサーバーの/etc/openldap/certsにコピーします。

  8. クライアントがアクセスするCA証明書をホストするようにWebサーバーを設定します。 次のステップでは、LDAPサーバーでこの機能を実行することを前提としています。 かわりに適切な代替サーバーを使用することもできます。

    1. Apache HTTPサーバーをインストールします。

      # yum install httpd

    2. /var/www/htmlの下に、次の例のようにCA証明書のディレクトリを作成します。

      # mkdir /var/www/html/certs

    3. CA証明書を/var/www/html/certsにコピーします。

      # cp CAcert.pem /var/www/html/certs

      注意

      キー・ファイルはコピーしないでください。

    4. HTTPサーバー構成ファイル/etc/httpd/conf/httpd.confを編集して、サーバーの解決可能なドメイン名をServerNameの引数に指定します。

      ServerName server_addr:80

      サーバーが解決可能なドメイン名を持たない場合、かわりにそのIPアドレスを入力します。

      <Directory "/var/www/html">セクションのOptionsディレクティブの設定で、次のようにIndexesおよびFollowSymLinksを指定し、ディレクトリ階層が参照可能になっていることを確認します。

      Options Indexes FollowSymLinks

    5. Apache HTTPサーバーを起動して、再起動後に開始するようにそれを構成します。

      # service httpd start
      # chkconfig httpd on

    6. システムでファイアウォールを有効にしている場合、TCPポート80でHTTP接続リクエストを受信できるようにそれを構成します。

      たとえば、次のコマンドでは、HTTP接続リクエストを受信できるようにiptablesを構成し、その変更をファイアウォール構成に保存します。

      # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
      # service iptables save