diff options
author | Tommaso Tocci <tommaso.tocci@mongodb.com> | 2021-06-17 11:50:10 +0000 |
---|---|---|
committer | Marcos José Grillo Ramirez <marcos.grillo@mongodb.com> | 2021-08-30 19:20:40 +0200 |
commit | 2e5dfc90df4e955eedc95be37e907f24eddf8fad (patch) | |
tree | 0b7ac194428b320347616868ff3842170e60c75a | |
parent | 42a788b183b72029bc83f04bacc6d7bfa87bfad2 (diff) | |
download | mongo-2e5dfc90df4e955eedc95be37e907f24eddf8fad.tar.gz |
SERVER-57740 ShardingTest use X509 also with preferTLS mode
(cherry picked from commit 5205bcea3a1506d160bc8b106bf8317844fd943c)
-rw-r--r-- | src/mongo/shell/shardingtest.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 064d67bf23b..4c405ccad69 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -779,16 +779,20 @@ var ShardingTest = function(params) { continue; } + const tlsOptions = ['preferTLS', 'requireTLS']; + const sslOptions = ['preferSSL', 'requireSSL']; + const TLSEnabled = currNode.fullOptions && + (tlsOptions.includes(currNode.fullOptions.tlsMode) || + sslOptions.includes(currNode.fullOptions.sslMode)); + const x509AuthRequired = (conn.fullOptions && conn.fullOptions.clusterAuthMode && - conn.fullOptions.clusterAuthMode === "x509" && - (currNode.fullOptions.sslMode === "requireSSL" || - currNode.fullOptions.tlsMode === "requireTLS")); + conn.fullOptions.clusterAuthMode === "x509"); if (keyFileUsed) { authutil.asCluster(currNode, keyFileUsed, () => { getShardVersion(currNode, timeoutMs - diff); }); - } else if (x509AuthRequired) { + } else if (x509AuthRequired && TLSEnabled) { const exitCode = _runMongoProgram( ...["mongo", currNode.host, |