diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2017-10-05 14:16:16 -0400 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2017-10-06 11:13:50 -0400 |
commit | 91a1b244bb8772f07343e8c2484768c2ceb7cb9e (patch) | |
tree | 07c7866ab299fc7832fd59597b7490950dff2361 | |
parent | 5d1c412f41a42dd69c5e76d7aafc9efa3b204678 (diff) | |
download | mongo-91a1b244bb8772f07343e8c2484768c2ceb7cb9e.tar.gz |
SERVER-31308 Add startup deprecation warning for systems using MONGODB-CR
-rw-r--r-- | jstests/auth/mongodb_cr_deprecation_warning.js | 29 | ||||
-rw-r--r-- | src/mongo/db/db.cpp | 10 |
2 files changed, 39 insertions, 0 deletions
diff --git a/jstests/auth/mongodb_cr_deprecation_warning.js b/jstests/auth/mongodb_cr_deprecation_warning.js new file mode 100644 index 00000000000..e611bc80443 --- /dev/null +++ b/jstests/auth/mongodb_cr_deprecation_warning.js @@ -0,0 +1,29 @@ +// Tests startup warning for deprecated authSchemaVersion +(function() { + "use strict"; + + const dbpath = MongoRunner.dataPath + "mongodb_cr_deprecation_warning"; + resetDbpath(dbpath); + + { + // Setup database using schema version 3 + const conn = MongoRunner.runMongod({dbpath: dbpath}); + conn.getDB("admin").system.version.update( + {_id: "authSchema"}, {"currentVersion": 3}, {upsert: true}); + MongoRunner.stopMongod(conn); + } + + { + // Mount "old" database using new mongod + const conn = MongoRunner.runMongod({dbpath: dbpath, noCleanData: true, useLogFiles: true}); + const admin = conn.getDB("admin"); + + // Look for our new warning + assert.soon(function() { + const log = cat(conn.fullOptions.logFile); + return /WARNING: This server is using MONGODB-CR/.test(log); + }, "No warning issued for MONGODB-CR usage", 30 * 1000, 5 * 1000); + + MongoRunner.stopMongod(conn); + } +})(); diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index e900b12c6c7..75f78a3e967 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -707,6 +707,16 @@ ExitCode _initAndListen(int listenPort) { << "2.6 and then run the authSchemaUpgrade command."; exitCleanly(EXIT_NEED_UPGRADE); } + + if (foundSchemaVersion <= AuthorizationManager::schemaVersion26Final) { + log() << startupWarningsLog; + log() << "** WARNING: This server is using MONGODB-CR, a deprecated authentication " + << "mechanism." << startupWarningsLog; + log() << "** Support will be dropped in a future release." + << startupWarningsLog; + log() << "** See http://dochub.mongodb.org/core/3.0-upgrade-to-scram-sha-1" + << startupWarningsLog; + } } else if (globalAuthzManager->isAuthEnabled()) { error() << "Auth must be disabled when starting without auth schema validation"; exitCleanly(EXIT_BADOPTIONS); |