[SERVER-7160] Mongorestore doesn't auth against admin DB when using username and password arguments Created: 25/Sep/12  Updated: 30/Oct/15  Resolved: 26/Sep/12

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.2.0
Fix Version/s: 2.2.1, 2.3.0

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-7262 mongorestore on 2.2 fails with "Inval... Closed
Related
related to SERVER-7181 Assertion: 13111:field not found, exp... Closed
Operating System: ALL
Participants:

 Description   

The problem is the only way to specify the database to authenticate to is to use the -d parameter, this parameter also means the target database to restore to. And with -d specified, you can only restore single db at time.

Current work around is to either (1) temporarily turn off auth or (2) add users with write privilege for every database you want to restore.

Other tools probably have the same issue.



 Comments   
Comment by auto [ 02/Oct/12 ]

Author:

{u'date': u'2012-09-26T08:54:55-07:00', u'email': u'spencer@10gen.com', u'name': u'Spencer T Brody'}

Message: SERVER-7160 Full mongorestore with auth should auth only against the admin db
Branch: v2.2
https://github.com/mongodb/mongo/commit/5eb79913ff0ceb6fbf782d8a1ec965ae95880fb4

Comment by auto [ 26/Sep/12 ]

Author:

{u'date': u'2012-09-26T08:54:55-07:00', u'email': u'spencer@10gen.com', u'name': u'Spencer T Brody'}

Message: SERVER-7160 Full mongorestore with auth should auth only against the admin db
Branch: master
https://github.com/mongodb/mongo/commit/a77a8a9249b731a59d15d42c3133243f6376cc77

Comment by Spencer Brody (Inactive) [ 26/Sep/12 ]

Seems to me that rather than add a new parameter to mongorestore, it should just assume it should auth against the admin DB when doing a full restore. It actually tries to do this, but the problem is that it's first trying to auth with the db specified, which in a full restore is the empty string "". Seems that in 2.0 running the auth commands against an emtpy database string didn't cause an error, but it does now in 2.2. Skipping the auth attempt in mongorestore against the empty db name should allow it to get to the auth against the admin db, resolving this issue.

CR coming soon.

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