2018-01-13 01:11:14 +01:00
|
|
|
// Test the special handling of the __system user
|
|
|
|
// works when the SCRAM-SHA-1 pw auth mechanisms are disabled.
|
|
|
|
(function() {
|
2019-07-27 00:20:35 +02:00
|
|
|
"use strict";
|
2018-01-13 01:11:14 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Start mongod with no authentication mechanisms enabled
|
|
|
|
var m = MongoRunner.runMongod(
|
|
|
|
{keyFile: "jstests/libs/key1", setParameter: "authenticationMechanisms=PLAIN"});
|
2018-01-13 01:11:14 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Verify that it's possible to use SCRAM-SHA-1 to authenticate as the __system@local user
|
|
|
|
assert.eq(1,
|
|
|
|
m.getDB("local").auth({user: "__system", pwd: "foopdedoop", mechanism: "SCRAM-SHA-1"}));
|
2018-01-13 01:11:14 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Verify that it is not possible to authenticate other users
|
|
|
|
m.getDB("test").runCommand({createUser: "guest", pwd: "guest", roles: jsTest.readOnlyUserRoles});
|
|
|
|
assert.eq(0, m.getDB("test").auth({user: "guest", pwd: "guest", mechanism: "SCRAM-SHA-1"}));
|
2018-01-13 01:11:14 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
MongoRunner.stopMongod(m);
|
2018-01-13 01:11:14 +01:00
|
|
|
})();
|