[SERVER-6427] mongos does not support copydbgetnonce Created: 12/Jul/12  Updated: 10/Sep/18  Resolved: 10/Sep/18

Status: Closed
Project: Core Server
Component/s: Security
Affects Version/s: 2.0.6, 2.1.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Bernie Hackett Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-13080 Cannot run "copydb" within sharded cl... Closed
Operating System: ALL
Participants:

 Description   

This makes it impossible to use copydb in a sharded cluster with authentication.

mongos> db.runCommand(

{'copydbgetnonce': 1, 'fromhost': 'localhost:27017'}

)
Thu Jul 12 13:40:18 uncaught exception: error

{ "$err" : "unrecognized command: copydbgetnonce", "code" : 13390 }

 Comments   
Comment by Sara Williamson [ 10/Sep/18 ]

We are removing copydb, so this is gone away.

Comment by A. Jesse Jiryu Davis [ 11/Nov/14 ]

We'll need copydbsaslstart instead of, or as well as, copydbgetnonce to support copydb with auth in 2.8+: SERVER-15684.

Comment by Shaun Verch [ 10/Mar/14 ]

Here's a jstest test case to reproduce the issue:

TestData.authMechanism = "MONGODB-CR"; // SERVER-11428
DB.prototype._defaultAuthenticationMechanism = "MONGODB-CR"; // SERVER-11428
 
var baseName = "jstests_clone_copyauth";
 
// Create single node source with auth enabled
var source = MongoRunner.runMongod({ auth : "" });
 
// Insert doc into source
source.getDB(baseName)[baseName].save({i:1});
assert.eq(1, source.getDB(baseName)[baseName].count());
assert.eq(1, source.getDB(baseName)[baseName].findOne().i);
 
// Setup auth
source.getDB("admin").createUser({ user: "super", pwd: "super", roles: [ "root" ] });
source.getDB("admin").auth("super", "super");
source.getDB(baseName).createUser({ user: "foo", pwd: "bar", roles: [ "dbOwner" ] });
source.getDB("admin").logout();
assert.throws(function() { source.getDB(baseName)[baseName].findOne(); });
 
// Create sharded cluster as target of copy
var shardingTestConfig = {
    name : baseName + "_target",
    mongos : 1,
    shards : 1,
    config : 1,
    verbose : 8
}
var targetCluster = new ShardingTest(shardingTestConfig);
var target = targetCluster.s;
 
// Drop db on target and run "copydb"
target.getDB(baseName).dropDatabase();
assert.eq(0, target.getDB(baseName)[baseName].count());
assert.commandWorked(target.getDB(baseName).copyDatabase(baseName, baseName, source.host,
                                                            "foo", "bar"));
assert.eq(1, target.getDB(baseName)[baseName].count());
assert.eq(1, target.getDB(baseName)[baseName].findOne().i);
 
// Cleanup
MongoRunner.stopMongod(source.port);
targetCluster.stop();

Comment by Andy Schwerin [ 07/Mar/13 ]

Not clear if the right fix is to make copydbgetnonce work on mongos, or to change copydb to not use its own authentication protocol. I lean toward the latter.

Generated at Thu Feb 08 03:11:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.