hnm
hnm

Reputation: 829

Mongodb: Is it possible to turn off authentication for connections from localhost only?

Here is my scenario - I have a webapp and mongodb running on same host. And I have not enabled authorization in mongod.conf. So, my webapp, connects to mongodb with out any authentication. Now I want to provide access to mongodb for certain group of people who will connect from outside. Since, connections will be made from outside, I need to enable authentication. But, if I enable authentication webapp will not be able to connect to mongodb(which assumes mongodb is running on localhost and it does not require authentication). I do not want to change webapp to connect to mongodb with authentication. So, I want to disable authentication only for connections from localhost. Is it possible?

Upvotes: 1

Views: 3200

Answers (1)

Marco
Marco

Reputation: 761

No, it's not possible from Mongo 3.0 version The only case where localhost authentication bypass occurs is when there are no configured users, with enableLocalhostAuthBypass parameter (Enabled by default). Your scenario can only be solved by creating multiple roles / users with different privileges

Upvotes: 3

Related Questions