AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。

TLS/SSL を使用するためにクラスターをアップグレードする

MongoDB サーバーは、同じ TCP ポートで TLS/SSL で暗号化された接続と暗号化されていない接続の両方をリッスンすることをサポートしています。 これにより、MongoDB クラスターのアップグレードで、TLS/SSL 暗号化接続を使用できるようになります。

注意

MongoDB は、TLS 1.2+ が利用可能なシステムでは、TLS 1.0 および TLS 1.1暗号化のサポートを無効にします。

重要

TLS/SSL、PKI(公開キー基盤)証明書、認証局についての詳細な説明は、このドキュメントの範囲外です。このページでは、TLS/SSL に関する予備知識があり、有効な証明書にアクセスすることを前提としています。

TLS/SSL 暗号化を使用しない MongoDB クラスターから、TLS/SSL 暗号化のみを使用する MongoDB クラスターにアップグレードするには、次のローリング アップグレード プロセスを使用します。

注意

このセクションの手順では、 tls設定/オプションを使用します。 sslエイリアスの使用手順については、「手順( ssl設定の使用) 」を参照してください。

MongoDB では常に TLS 1.0 以降をサポートしているため、 tlsの設定/オプションはsslオプションと同じ機能を提供します。

  1. For each node of a cluster, start the node with the command-line option --tlsMode or the configuration file option net.tls.mode set to allowTLS. The allowTLS setting allows the node to accept both TLS/SSL and non-TLS/non-SSL incoming connections. Its connections to other servers do not use TLS/SSL. Include other TLS/SSL options [1] as well as any other options that are required for your specific configuration.

    注意

    mongod と mongos は、デフォルトで localhost にバインドされます。配置のノードが異なるホスト上で実行されている場合、またはリモート クライアントを配置に接続する場合は、--bind_ip または net.bindIp を指定する必要があります。

    以下に例を挙げます。

    mongod --replSet <name> --tlsMode allowTLS --tlsCertificateKeyFile <TLS/SSL certificate and key file> --tlsCAFile <path to root CA PEM file> <additional options>

    クラスターのすべてのノードをこれらの設定にアップグレードします。

  2. すべてのクライアントを TLS/SSL 使用に切り替えます。参照: TLS が有効なレプリカセットへの接続。

  3. For each node of a cluster, use the setParameter command to update the tlsMode to preferTLS. [2] With preferTLS as its net.tls.mode, the node accepts both TLS/SSL and non-TLS/non-SSL incoming connections, and its connections to other servers use TLS/SSL. For example:

    db.adminCommand( { setParameter: 1, tlsMode: "preferTLS" } )

    クラスターのすべてのノードをこれらの設定にアップグレードします。

    この時点で、すべての接続は TLS/SSL を使用するはずです。

  4. For each node of the cluster, use the setParameter command to update the tlsMode to requireTLS. [2] With requireTLS as its net.tls.mode, the node will reject any non-TLS/non-SSL connections. For example:

    db.adminCommand( { setParameter: 1, tlsMode: "requireTLS" } )
  5. すべてのノードをアップグレードした後、適切な TLS/SSL 設定で構成ファイルを編集し、次回の再起動時にクラスターが TLS/SSL を使用するようにします。

重要

TLS/SSL、PKI(公開キー基盤)証明書、認証局についての詳細な説明は、このドキュメントの範囲外です。このページでは、TLS/SSL に関する予備知識があり、有効な証明書にアクセスすることを前提としています。

TLS/SSL 暗号化を使用しない MongoDB クラスターから、TLS/SSL 暗号化のみを使用する MongoDB クラスターにアップグレードするには、次のローリング アップグレード プロセスを使用します。

注意

このセクションの手順では、ssl 設定/オプションを使用します。tls エイリアスを使用する手順については、「TLS/SSL を使用するようにクラスターをアップグレードする」を参照してください。

MongoDB では常に TLS 1.0 以降をサポートしているため、 tlsの設定/オプションはsslオプションと同じ機能を提供します。

  1. For each node of a cluster, start the node with the command-line option --sslMode or the configuration file option net.ssl.mode set to allowSSL. The allowSSL setting allows the node to accept both TLS/SSL and non-TLS/non-SSL incoming connections. Its connections to other servers do not use TLS/SSL. Include other TLS/SSL options [1] as well as any other options that are required for your specific configuration.

    注意

    mongod と mongos は、デフォルトで localhost にバインドされます。配置のノードが異なるホスト上で実行されている場合、またはリモート クライアントを配置に接続する場合は、--bind_ip または net.bindIp を指定する必要があります。

    以下に例を挙げます。

    mongod --replSet <name> --sslMode allowSSL --sslPEMKeyFile <path to TLS/SSL Certificate and key PEM file> --sslCAFile <path to root CA PEM file> <additional options>

    クラスターのすべてのノードをこれらの設定にアップグレードします。

  2. すべてのクライアントを TLS/SSL 使用に切り替えます。参照: TLS が有効なレプリカセットへの接続。

  3. For each node of a cluster, use the setParameter command to update the sslMode to preferSSL. [2] With preferSSL as its net.ssl.mode, the node accepts both TLS/SSL and non-TLS/non-SSL incoming connections, and its connections to other servers use TLS/SSL. For example:

    db.adminCommand( { setParameter: 1, sslMode: "preferSSL" } )

    クラスターのすべてのノードをこれらの設定にアップグレードします。

    この時点で、すべての接続は TLS/SSL を使用するはずです。

  4. For each node of the cluster, use the setParameter command to update the sslMode to requireSSL. [2] With requireSSL as its net.ssl.mode, the node rejects any non-TLS/non-SSL connections. For example:

    db.adminCommand( { setParameter: 1, sslMode: "requireSSL" } )
  5. すべてのノードをアップグレードした後、適切な TLS/SSL 設定で構成ファイルを編集し、次回の再起動時にクラスターが TLS/SSL を使用するようにします。

[2](1, 2, 3, 4) As an alternative to using the setParameter command, you can also restart the nodes with the appropriate TLS/SSL options and values.
[1](1, 2)

Windows と macOS のシステム SSL 証明書ストアを使用できます。 システム SSL 証明書ストアを使用するには、以下を使用します。

  • net.tls.certificateSelector{ }(またはコマンドライン--tlsCertificateSelector net.tls.certificateKeyFileオプション``-certifyKeyFile``)ではなく、 (またはコマンドライン オプション )。

  • net.ssl.certificateSelector net.ssl.PEMKeyFile (またはコマンドライン オプション``--sslPEMKeyFile``) ではなく、(またはコマンドライン オプション--sslCertificateSelector )。

システムの SSL 証明書ストアを使用する場合、 OCSP(オンライン証明書ステータス プロトコル)を使用して証明書の失効状態を検証します。

このページを評価