summaryrefslogtreecommitdiff
path: root/jstests/ssl
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
commit6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch)
treec8cfb5acb62c80f375bc37e7d4350382deea6a37 /jstests/ssl
parentd4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff)
downloadmongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz
SERVER-23971 Clang-Format code
Diffstat (limited to 'jstests/ssl')
-rw-r--r--jstests/ssl/disable_x509.js9
-rw-r--r--jstests/ssl/libs/ssl_helpers.js15
-rw-r--r--jstests/ssl/ssl_hostname_validation.js4
-rw-r--r--jstests/ssl/ssl_without_ca.js6
-rw-r--r--jstests/ssl/upgrade_to_x509_ssl.js42
-rw-r--r--jstests/ssl/x509_client.js46
6 files changed, 64 insertions, 58 deletions
diff --git a/jstests/ssl/disable_x509.js b/jstests/ssl/disable_x509.js
index 5663f6a6196..c386b84c591 100644
--- a/jstests/ssl/disable_x509.js
+++ b/jstests/ssl/disable_x509.js
@@ -29,9 +29,12 @@ if (cmdOut.ok) {
});
// Localhost exception should not be in place anymore
- assert.throws(function() {
- test.foo.findOne();
- }, {}, "read without login");
+ assert.throws(
+ function() {
+ test.foo.findOne();
+ },
+ {},
+ "read without login");
assert(external.auth({user: CLIENT_USER, mechanism: 'MONGODB-X509'}),
"authentication with valid user failed");
diff --git a/jstests/ssl/libs/ssl_helpers.js b/jstests/ssl/libs/ssl_helpers.js
index 8067076610e..50463d8dec9 100644
--- a/jstests/ssl/libs/ssl_helpers.js
+++ b/jstests/ssl/libs/ssl_helpers.js
@@ -9,9 +9,7 @@ var CLIENT_CERT = "jstests/libs/client.pem";
// Note: "sslAllowInvalidCertificates" is enabled to avoid
// hostname conflicts with our testing certificates
-var disabled = {
- sslMode: "disabled"
-};
+var disabled = {sslMode: "disabled"};
var allowSSL = {
sslMode: "allowSSL",
sslAllowInvalidCertificates: "",
@@ -81,10 +79,13 @@ function testShardedLookup(shardingTest) {
assert.writeOK(fooBulk.execute());
assert.writeOK(barBulk.execute());
- var docs = lookupdb.foo.aggregate([
- {$sort: {_id: 1}},
- {$lookup: {from: "bar", localField: "_id", foreignField: "_id", as: "bar_docs"}}
- ]).toArray();
+ var docs =
+ lookupdb.foo
+ .aggregate([
+ {$sort: {_id: 1}},
+ {$lookup: {from: "bar", localField: "_id", foreignField: "_id", as: "bar_docs"}}
+ ])
+ .toArray();
assert.eq(lookupShouldReturn, docs, "error $lookup failed in this configuration");
assert.commandWorked(lookupdb.dropDatabase());
}
diff --git a/jstests/ssl/ssl_hostname_validation.js b/jstests/ssl/ssl_hostname_validation.js
index ab727320744..9801e14807c 100644
--- a/jstests/ssl/ssl_hostname_validation.js
+++ b/jstests/ssl/ssl_hostname_validation.js
@@ -8,8 +8,8 @@ var CLIENT_CERT = "jstests/libs/client.pem";
var BAD_SAN_CERT = "jstests/libs/badSAN.pem";
function testCombination(certPath, allowInvalidHost, allowInvalidCert, shouldSucceed) {
- var mongod = MongoRunner.runMongod(
- {sslMode: "requireSSL", sslPEMKeyFile: certPath, sslCAFile: CA_CERT});
+ var mongod =
+ MongoRunner.runMongod({sslMode: "requireSSL", sslPEMKeyFile: certPath, sslCAFile: CA_CERT});
var mongo;
if (allowInvalidCert) {
diff --git a/jstests/ssl/ssl_without_ca.js b/jstests/ssl/ssl_without_ca.js
index 0e865cc5fee..2255e019883 100644
--- a/jstests/ssl/ssl_without_ca.js
+++ b/jstests/ssl/ssl_without_ca.js
@@ -36,11 +36,7 @@ MongoRunner.stopMongod(conn.port);
jsTest.log("Assert mongod doesn\'t start with CA file missing and clusterAuthMode=x509.");
-var sslParams = {
- clusterAuthMode: 'x509',
- sslMode: 'requireSSL',
- sslPEMKeyFile: SERVER_CERT
-};
+var sslParams = {clusterAuthMode: 'x509', sslMode: 'requireSSL', sslPEMKeyFile: SERVER_CERT};
var conn = MongoRunner.runMongod(sslParams);
assert.isnull(conn, "server started with x509 clusterAuthMode but no CA file");
diff --git a/jstests/ssl/upgrade_to_x509_ssl.js b/jstests/ssl/upgrade_to_x509_ssl.js
index e9d79859077..2072d6c51c5 100644
--- a/jstests/ssl/upgrade_to_x509_ssl.js
+++ b/jstests/ssl/upgrade_to_x509_ssl.js
@@ -44,17 +44,16 @@ assert.eq(2, rstConn1.getDB("test").a.count(), "Error interacting with replSet")
print("===== UPGRADE allowSSL,sendKeyfile -> preferSSL,sendX509 =====");
authAllNodes();
rst.awaitReplication();
-rst.upgradeSet(
- {
- sslMode: "preferSSL",
- sslPEMKeyFile: SERVER_CERT,
- sslAllowInvalidCertificates: "",
- clusterAuthMode: "sendX509",
- keyFile: KEYFILE,
- sslCAFile: CA_CERT
- },
- "root",
- "pwd");
+rst.upgradeSet({
+ sslMode: "preferSSL",
+ sslPEMKeyFile: SERVER_CERT,
+ sslAllowInvalidCertificates: "",
+ clusterAuthMode: "sendX509",
+ keyFile: KEYFILE,
+ sslCAFile: CA_CERT
+},
+ "root",
+ "pwd");
// The upgradeSet call restarts the nodes so we need to reauthenticate.
authAllNodes();
var rstConn3 = rst.getPrimary();
@@ -66,17 +65,16 @@ var canConnectNoSSL = runMongoProgram("mongo", "--port", rst.ports[0], "--eval",
assert.eq(0, canConnectNoSSL, "SSL Connection attempt failed when it should succeed");
print("===== UPGRADE preferSSL,sendX509 -> requireSSL,x509 =====");
-rst.upgradeSet(
- {
- sslMode: "requireSSL",
- sslPEMKeyFile: SERVER_CERT,
- sslAllowInvalidCertificates: "",
- clusterAuthMode: "x509",
- keyFile: KEYFILE,
- sslCAFile: CA_CERT
- },
- "root",
- "pwd");
+rst.upgradeSet({
+ sslMode: "requireSSL",
+ sslPEMKeyFile: SERVER_CERT,
+ sslAllowInvalidCertificates: "",
+ clusterAuthMode: "x509",
+ keyFile: KEYFILE,
+ sslCAFile: CA_CERT
+},
+ "root",
+ "pwd");
authAllNodes();
var rstConn4 = rst.getPrimary();
rstConn4.getDB("test").a.insert({a: 4, str: "TESTTESTTEST"});
diff --git a/jstests/ssl/x509_client.js b/jstests/ssl/x509_client.js
index 82c726fc0fd..8c3b7254198 100644
--- a/jstests/ssl/x509_client.js
+++ b/jstests/ssl/x509_client.js
@@ -29,16 +29,22 @@ function authAndTest(mongo) {
test = mongo.getDB("test");
// It should be impossible to create users with the same name as the server's subject
- assert.throws(function() {
- external.createUser(
- {user: SERVER_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
- }, {}, "Created user with same name as the server's x.509 subject");
+ assert.throws(
+ function() {
+ external.createUser(
+ {user: SERVER_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
+ },
+ {},
+ "Created user with same name as the server's x.509 subject");
// It should be impossible to create users with names recognized as cluster members
- assert.throws(function() {
- external.createUser(
- {user: INTERNAL_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
- }, {}, "Created user which would be recognized as a cluster member");
+ assert.throws(
+ function() {
+ external.createUser(
+ {user: INTERNAL_USER, roles: [{'role': 'userAdminAnyDatabase', 'db': 'admin'}]});
+ },
+ {},
+ "Created user which would be recognized as a cluster member");
// Add user using localhost exception
external.createUser({
@@ -56,9 +62,12 @@ function authAndTest(mongo) {
});
// Localhost exception should not be in place anymore
- assert.throws(function() {
- test.foo.findOne();
- }, {}, "read without login");
+ assert.throws(
+ function() {
+ test.foo.findOne();
+ },
+ {},
+ "read without login");
assert(!external.auth({user: INVALID_CLIENT_USER, mechanism: 'MONGODB-X509'}),
"authentication with invalid user failed");
@@ -71,17 +80,16 @@ function authAndTest(mongo) {
test.foo.findOne();
external.logout();
- assert.throws(function() {
- test.foo.findOne();
- }, {}, "read after logout");
+ assert.throws(
+ function() {
+ test.foo.findOne();
+ },
+ {},
+ "read after logout");
}
print("1. Testing x.509 auth to mongod");
-var x509_options = {
- sslMode: "requireSSL",
- sslPEMKeyFile: SERVER_CERT,
- sslCAFile: CA_CERT
-};
+var x509_options = {sslMode: "requireSSL", sslPEMKeyFile: SERVER_CERT, sslCAFile: CA_CERT};
var mongo = MongoRunner.runMongod(Object.merge(x509_options, {auth: ""}));