summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorSara Golemon <sara.golemon@mongodb.com>2017-06-07 14:03:15 +0000
committerSara Golemon <sara.golemon@mongodb.com>2017-06-09 15:45:26 -0400
commit57838919a21acd61fcc679581999b092c91ef62e (patch)
tree79b976860c50a6786a2016c59adb715d3b0f4df1 /jstests
parent67500efdc1c677173c737ecde2b07b42015ae5fd (diff)
downloadmongo-57838919a21acd61fcc679581999b092c91ef62e.tar.gz
SERVER-27595 Add client IP address to authentication failure message
Diffstat (limited to 'jstests')
-rw-r--r--jstests/auth/auth-fail-client-addr.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/auth/auth-fail-client-addr.js b/jstests/auth/auth-fail-client-addr.js
new file mode 100644
index 00000000000..426821545bc
--- /dev/null
+++ b/jstests/auth/auth-fail-client-addr.js
@@ -0,0 +1,15 @@
+// Verify that client IP address is included in MONGODB-CR auth failure response
+
+function runTest(m) {
+ db = m.getDB("test");
+ db.auth({user: "root", pwd: "periwinkle", mechanism: "MONGODB-CR"});
+
+ assert.soon(function() {
+ var log = cat(m.fullOptions.logFile);
+ return /Failed to authenticate root@test from client 127\.0\.0\.1:\d+/.test(log);
+ }, "Authentication failure message not encountered or missing client IP", 30 * 1000, 5 * 1000);
+}
+
+print("START auth-fail-client-addr.js");
+runTest(MongoRunner.runMongod({useHostname: false, useLogFiles: true}));
+print("SUCCESS auth-fail-client-addr.js");