EqualExperts / Tayra

Incremental backup tool for MongoDB
Other
142 stars 29 forks source link

Unable to connect with mongodb standard URI or connect using db other than 'admin' #5

Open rudolf opened 10 years ago

rudolf commented 10 years ago

Tayra seems to always want to authenticate using 'admin' which makes it impossible to authenticate using db level users stored in .system.users .

It's also not possible to use the mongodb standard URI to connect to a db.

DhavalDalal commented 10 years ago

I think prima-facie it sounds like MongoDB thing as Tayra simply forwards the creds to MongoDB, but I'll ask the team to take a look into this. We will get back to you.

Also, it would be nice, if you could give us the steps to reproduce. Thanks!

viveksd87 commented 10 years ago

Hi, I think currently Tayra authenticates credentials only for "admin" database. What we need to do is accept the "database" as well to authenticate against.

rudolf commented 10 years ago

I managed to hard code it for my own use, but I haven't done enough groovy to attempt a pull request for a generic solution.

It might be helpful to look at the documentation for mongooplog: http://docs.mongodb.org/manual/reference/program/mongooplog/

"By default, mongooplog assumes that the database specified to the --db argument holds the user’s credentials, unless you specify --authenticationDatabase."

sameersoni commented 10 years ago

Hi Rudolf, I went through the issue, and --authenticationDatabase is introduced from 2.4 onwards. We are planning to introduce --authDb as a command line argument, which will take in the value for DB where credentials are stored. For backward compatibility, ie for version below 2.4, we will keep --authDb parameter, and if user provides say '--authDB "someDB"', then too credentials will be looked for in 'admin' database. For version >= 2.4, user will be authenticated using the authDb he specified. Does this sounds good?