Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with authentication system #16

Open
syrm opened this issue Oct 16, 2012 · 11 comments
Open

Problem with authentication system #16

syrm opened this issue Oct 16, 2012 · 11 comments

Comments

@syrm
Copy link

syrm commented Oct 16, 2012

Still not ok.
mongodb://admin:adminpassword@localhost:27017/admin?auto_reconnect : OK
mongodb://admin:adminpassword@localhost:27017/otherdatabase?auto_reconnect : auth fails
mongodb://otherdatabase:otherdatabasepassword@localhost:27017/otherdatabase?auto_reconnect : need to login

@yocontra
Copy link
Owner

AFAIK this is an issue with mongo core - my pull req has been accepted but hasn't been pushed into master.

@akumpf
Copy link
Contributor

akumpf commented Oct 28, 2012

+1 Smog looks fantastic, but auth seems pretty important for any dataset you actually care about.

I've been trying different ways to authenticate with the database, but no luck (besides directly accessing admin as shown above).

Also a quick suggestions in the meantime: hide the password info in the URL in logs (seeing the password in plaintext gives me the willies).

Could be simple as this

// assume url is something like this
var url = "http://test:1234@localhost:27017/test";

// remove the username and password from the URL and show as placeholders.
var safeurl = url.replace(/(\:\/\/)(.*?)(\@)/, "://user:****@");

console.log(safeurl);
// result is: "http://user:****@localhost:27017/test"

Keep us posted if you have any other thoughts or workarounds! :)

@yocontra
Copy link
Owner

@akumpf - That log is for debugging and shouldn't really be there - feel free to remove it and pull req

@yocontra
Copy link
Owner

Can you guys check if this issue occurs with https://github.com/kissjs/node-mongoskin ?

@akumpf
Copy link
Contributor

akumpf commented Oct 29, 2012

I think this pull request should take care of the logging issue. (of course you could just kill it instead).

#18

@akumpf
Copy link
Contributor

akumpf commented Oct 29, 2012

Ok. I think I've tracked the login problems down to admin.coffee.

The problem occurs because the script goes forward trying to perform admin operations (like getting the server status and build info) when using a non-admin user.

Returning null for failed data (or some other placeholder?) seems like a simple solution for now. In other words, try to get the admin info as currently built, but don't throw an error upstream on fail.

Additionally curious is that logging in as admin and trying to open a database outside of admin seems to not work and throw an error as well. Looking into this, for a mongo db with authentication, you must authenticate against the "admin" db before you an access other databases and perform admin operations. Adding a couple lines takes care of that, too :)

It's working great for me (trying admin auth, as well as per-database auth), so I'll create a pull request shortly.

Cheers,
Adam

@ghost
Copy link

ghost commented Jan 3, 2013

This looks great but is virtually useless w/out authentication working.

@fabriziomoscon
Copy link

Any updates on this?
I wish to connect to a remote DB hosted by MongoLAB/Nodejitsu, I can connect via shell but not with smog... does anybody have a workaround?

@yocontra
Copy link
Owner

Not doing any more work on this version - will be doing a full rewrite and this will be fixed in that. Will accept PRs to fix it in the meantime though

@BrandonCopley
Copy link

are there any mongo clients like active admin that we can use now?

@yocontra
Copy link
Owner

yocontra commented Apr 3, 2013

@BrandonCopley - There are a few PHP based ones but I've never used them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants