summaryrefslogtreecommitdiff
path: root/jstests/ssl/ssl_cn_with_san.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/ssl/ssl_cn_with_san.js')
-rw-r--r--jstests/ssl/ssl_cn_with_san.js68
1 files changed, 34 insertions, 34 deletions
diff --git a/jstests/ssl/ssl_cn_with_san.js b/jstests/ssl/ssl_cn_with_san.js
index 41e039c0a48..c033b935382 100644
--- a/jstests/ssl/ssl_cn_with_san.js
+++ b/jstests/ssl/ssl_cn_with_san.js
@@ -2,45 +2,45 @@
// does not permit connection, but provides a useful error.
(function() {
- 'use strict';
- load('jstests/ssl/libs/ssl_helpers.js');
+'use strict';
+load('jstests/ssl/libs/ssl_helpers.js');
- // server-intermediate-ca was signed by ca.pem, not trusted-ca.pem
- const CA = 'jstests/libs/ca.pem';
- const SERVER = 'jstests/ssl/libs/localhost-cn-with-san.pem';
+// server-intermediate-ca was signed by ca.pem, not trusted-ca.pem
+const CA = 'jstests/libs/ca.pem';
+const SERVER = 'jstests/ssl/libs/localhost-cn-with-san.pem';
- const mongod = MongoRunner.runMongod({
- sslMode: 'requireSSL',
- sslPEMKeyFile: SERVER,
- sslCAFile: CA,
- });
- assert(mongod);
+const mongod = MongoRunner.runMongod({
+ sslMode: 'requireSSL',
+ sslPEMKeyFile: SERVER,
+ sslCAFile: CA,
+});
+assert(mongod);
- // Try with `tlsAllowInvalidHostnames` to look for the warning.
+// Try with `tlsAllowInvalidHostnames` to look for the warning.
+clearRawMongoProgramOutput();
+const mongo = runMongoProgram('mongo',
+ '--tls',
+ '--tlsCAFile',
+ CA,
+ 'localhost:' + mongod.port,
+ '--eval',
+ ';',
+ '--tlsAllowInvalidHostnames');
+assert.neq(mongo, 0, "Shell connected when it should have failed");
+assert(rawMongoProgramOutput().includes(' would have matched, but was overridden by SAN'),
+ 'Expected detail warning not seen');
+
+// On OpenSSL only, start without `tlsAllowInvalidHostnames`
+// Windowds/Mac will bail out too early to show this message.
+if (determineSSLProvider() === 'openssl') {
clearRawMongoProgramOutput();
- const mongo = runMongoProgram('mongo',
- '--tls',
- '--tlsCAFile',
- CA,
- 'localhost:' + mongod.port,
- '--eval',
- ';',
- '--tlsAllowInvalidHostnames');
+ const mongo = runMongoProgram(
+ 'mongo', '--tls', '--tlsCAFile', CA, 'localhost:' + mongod.port, '--eval', ';');
assert.neq(mongo, 0, "Shell connected when it should have failed");
- assert(rawMongoProgramOutput().includes(' would have matched, but was overridden by SAN'),
+ assert(rawMongoProgramOutput().includes(
+ 'CN: localhost would have matched, but was overridden by SAN'),
'Expected detail warning not seen');
+}
- // On OpenSSL only, start without `tlsAllowInvalidHostnames`
- // Windowds/Mac will bail out too early to show this message.
- if (determineSSLProvider() === 'openssl') {
- clearRawMongoProgramOutput();
- const mongo = runMongoProgram(
- 'mongo', '--tls', '--tlsCAFile', CA, 'localhost:' + mongod.port, '--eval', ';');
- assert.neq(mongo, 0, "Shell connected when it should have failed");
- assert(rawMongoProgramOutput().includes(
- 'CN: localhost would have matched, but was overridden by SAN'),
- 'Expected detail warning not seen');
- }
-
- MongoRunner.stopMongod(mongod);
+MongoRunner.stopMongod(mongod);
})();