summaryrefslogtreecommitdiff
path: root/jstests/ssl
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-04-17 14:52:00 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-04-18 12:01:59 -0400
commitb1d30046c769ed625faf301c8b62186c4aeee86e (patch)
tree9133d061961ec728b4edf787f78dc7c799d7947d /jstests/ssl
parentb16d3ec219dfe5af1b2f8d5bf435a32a6f47ee4f (diff)
downloadmongo-b1d30046c769ed625faf301c8b62186c4aeee86e.tar.gz
SERVER-13644 Fix command line censorship
Diffstat (limited to 'jstests/ssl')
-rw-r--r--jstests/ssl/ssl_options.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/ssl/ssl_options.js b/jstests/ssl/ssl_options.js
new file mode 100644
index 00000000000..f4dcb4d4d47
--- /dev/null
+++ b/jstests/ssl/ssl_options.js
@@ -0,0 +1,35 @@
+var baseName = "jstests_ssl_ssl_options";
+
+jsTest.log("Testing censorship of ssl options");
+
+var mongodConfig = { sslPEMKeyFile : "jstests/libs/password_protected.pem",
+ sslMode : "requireSSL",
+ sslPEMKeyPassword : "qwerty",
+ sslClusterPassword : "qwerty" };
+var mongodSource = MongoRunner.runMongod(mongodConfig);
+
+var getCmdLineOptsResult = mongodSource.adminCommand("getCmdLineOpts");
+
+var i;
+var isPassword = false;
+for (i = 0; i < getCmdLineOptsResult.argv.length; i++) {
+ if (isPassword) {
+ assert.eq(getCmdLineOptsResult.argv[i], "<password>",
+ "Password not properly censored: " + tojson(getCmdLineOptsResult));
+ isPassword = false;
+ continue;
+ }
+
+ if (getCmdLineOptsResult.argv[i] === "--sslPEMKeyPassword" ||
+ getCmdLineOptsResult.argv[i] === "--sslClusterPassword") {
+ isPassword = true;
+ }
+}
+assert.eq(getCmdLineOptsResult.parsed.net.ssl.PEMKeyPassword, "<password>",
+ "Password not properly censored: " + tojson(getCmdLineOptsResult));
+assert.eq(getCmdLineOptsResult.parsed.net.ssl.clusterPassword, "<password>",
+ "Password not properly censored: " + tojson(getCmdLineOptsResult));
+
+MongoRunner.stopMongod(mongodSource.port);
+
+print(baseName + " succeeded.");