Rotate X.509 Certificates with clusterAuthX509 Attributes on Self-Managed Clusters
バージョン 7.0 で追加。
Cluster members can use X.509 certificates
for membership authentication to identify other servers
in the same deployment. This tutorial describes how to perform
a rolling update to rotate X.509 certificates on a cluster
that uses the net.tls.clusterAuthX509.attributes
settings to configure
the cluster members' Distinguished Name (DN) attributes.
注意
To perform a rolling update to rotate certificates on a cluster that doesn't
use the net.tls.clusterAuthX509
settings and won't after the update,
see Rotate X.509 Certificates without clusterAuthX509 Attributes on Self-Managed Clusters.
When a server configured with the net.tls.clusterAuthX509.attributes
setting
receives a connection request, it compares the Distinguished Name (DN) attributes
in the subject
field of the presented certificates to the configured values of the
attributes
setting and
tlsClusterAuthX509Override
parameter.
If the values match, it treats the connection as a cluster member.
In some situations, you may need to update the member certificates to new certificates with a new Distinguished Name (DN), such as if an organization changes its name. In a rolling update, member certificates are updated one at a time, and your deployment does not incur any downtime.
Clusters adopting new certificates can use the
tlsClusterAuthX509Override
parameter to accept X.509 certificates
with different subject DN attributes during the certificate rotation procedure. Once
all members use certificates with the new value, remove the override to begin
rejecting the now out of date certificates.
このタスクについて
と 設定を使用して設定されたメンバー証明書が、 組織とclusterFile
certificateKeyFile
組織単位を使用する識別名(DN)属性を持つレプリカセットを検討します。10gen
10gen Server
これらの DN 属性は、net.tls.clusterAuthX509.attributes
設定を使用して設定されます。
このレプリカセットのノードには、次の構成ファイルがあります。
security: clusterAuthMode: x509 net: tls: mode: requireTLS certificateKeyFile: /etc/mycerts/10gen-server1.pem CAFile: /etc/mycerts/ca.pem clusterFile: /etc/mycerts/10gen-cluster1.pem clusterCAFile: /etc/mycerts/ca.pem clusterAuthX509: attributes: O=10gen, OU=10gen Server
The following procedure updates each replica set member's X.509 certificates to new
certificates that have DN attributes that use the
MongoDB
organization and MongoDB Server
organizational unit.
注意
The following procedure assumes that the new X.509 certificates meet membership certificate and all other requirements and that the cluster configuration identifies peer certificates using Distinguished Name (DN) values. For more information, see ノード証明書の要件.
手順
These steps update member certificates to use new X.509 certificates on a cluster
configured with the net.tls.clusterAuthX509.attributes
setting.
The new certificates have Distinguished Names (DN) that change the
Organization (O) attributes from 10gen
to MongoDB
and the
Organizational Unit (OU) attribute from 10gen Server
to MongoDB Server
.
TLS クラスターのメンバーシップ構成の更新
各サーバーの構成ファイルを更新します。
Change
attributes
setting to use the values on the new certificate古い証明書の DN 属性を使用するには、
tlsClusterAuthX509Override
パラメータを設定します。
以下に例を挙げます。
net: tls: mode: requireTLS certificateKeyFile: /etc/mycerts/mongodb-server1.pem CAFile: /etc/mycerts/ca.pem clusterFile: /etc/mycerts/mongodb-cluster1.pem clusterCAFile: /etc/mycerts/ca.pem clusterAuthX509: attributes: O=MongoDB, OU=MongoDB Server security: clusterAuthMode: x509 setParameter: tlsClusterAuthX509Override: { attributes: O=10gen, OU=10gen Server }
セカンダリ クラスター ノードの再起動
各セカンダリ クラスター ノードを再起動します。
mongosh
を使用して各セカンダリ クラスター メンバーに接続し、db.shutdownServer()
メソッドを使用してサーバーを停止します。use admin db.shutdownServer() サーバーを再起動します。
メンバーの状態を判別するには、
rs.status()
メソッドを使用します。rs.status().members このノードの
stateStr
フィールドにSECONDARY
の値が表示されるまで待ってから、次のセカンダリを再起動します。
Secondary servers in the replica set now accept peer connections from members using certificates with the new DN attributes.
プライマリ クラスター ノードの再起動
プライマリ ノードを再起動します。
mongosh
を使用してプライマリに接続し、rs.stepDown()
メソッドを使用してノードをプライマリから降格します。rs.stepDown() クラスターは、新しい証明書を持つセカンダリを、新しいプライマリとして機能するように昇格します。
サーバーをシャットダウンするには、
db.shutdownServer()
メソッドを使用します。use admin db.shutdownServer() サーバーを再起動します。
The primary server in the replica set steps down and restarts as a secondary that now accepts peer connections from members using certificates with the new DN attributes.
TLS 証明書の更新
各サーバーの構成ファイルを更新します。
新しい証明書を使用するには
net.tls.certificateKeyFile
設定を変更します。新しい証明書を使用するには
net.tls.clusterFile
設定を変更します。
以下に例を挙げます。
net: tls: mode: requireTLS certificateKeyFile: /etc/mycerts/mongodb-server2.pem CAFile: /etc/mycerts/ca.pem clusterFile: /etc/mycerts/mongodb-cluster2.pem clusterCAFile: /etc/mycerts/ca.pem clusterAuthX509: attributes: O=MongoDB, OU=MongoDB Server security: clusterAuthMode: x509 setParameter: tlsClusterAuthX509Override: { attributes: O=10gen, OU=10gen Server }
セカンダリ クラスター ノードの再起動
各セカンダリ クラスター ノードを再起動します。
mongosh
を使用して各セカンダリ クラスター メンバーに接続し、db.shutdownServer()
メソッドを使用してサーバーを停止します。use admin db.shutdownServer() サーバーを再起動します。
メンバーの状態を判別するには、
rs.status()
メソッドを使用します。rs.status().members このノードの
stateStr
フィールドにSECONDARY
の値が表示されるまで待ってから、次のセカンダリを再起動します。
Secondary servers in the replica set now use the new X.509 certificates.
プライマリ クラスター ノードの再起動
プライマリ ノードを再起動します。
mongosh
を使用してプライマリに接続し、rs.stepDown()
メソッドを使用してノードをプライマリから降格します。rs.stepDown() クラスターは、新しい証明書を持つセカンダリを、新しいプライマリとして機能するように昇格します。
サーバーをシャットダウンするには、
db.shutdownServer()
メソッドを使用します。use admin db.shutdownServer() サーバーを再起動します。
The primary server in the replica set steps down and restarts as a secondary that uses the new X.509 certificate.
DN 認証オーバーライド構成の削除
With all members of the cluster now using the new X.509 certificate,
update the configuration file to remove the setParameter
settings for the tlsClusterAuthX509Override
parameter.
以下に例を挙げます。
net: tls: mode: requireTLS certificateKeyFile: /etc/mycerts/mongodb-server1.pem CAFile: /etc/mycerts/ca.pem clusterFile: /etc/mycerts/mongodb-cluster1.pem clusterCAFile: /etc/mycerts/ca.pem clusterAuthX509: attributes: O=MongoDB, OU=MongoDB Server security: clusterAuthMode: x509
これにより、サーバーは起動時に古い証明書設定を構成しないようになります。
セカンダリ クラスター ノードの再起動
各セカンダリ クラスター ノードを再起動します。
mongosh
を使用して各セカンダリ クラスター メンバーに接続し、db.shutdownServer()
メソッドを使用してサーバーを停止します。use admin db.shutdownServer() サーバーを再起動します。
メンバーの状態を判別するには、
rs.status()
メソッドを使用します。rs.status().members このノードの
stateStr
フィールドにSECONDARY
の値が表示されるまで待ってから、次のセカンダリを再起動します。
Secondary servers in the replica set restart and no longer accept connections from the old X.509 certificates.
プライマリ クラスター ノードの再起動
プライマリ ノードを再起動します。
mongosh
を使用してプライマリに接続し、rs.stepDown()
メソッドを使用してノードをプライマリから降格します。rs.stepDown() クラスターは、新しい証明書を持つセカンダリを、新しいプライマリとして機能するように昇格します。
サーバーをシャットダウンするには、
db.shutdownServer()
メソッドを使用します。use admin db.shutdownServer() サーバーを再起動します。
The primary server steps down and restarts as a secondary that no longer accepts connections from the old X.509 certificates.