Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm wanting my website to use MongoDB as it's datastore. I've used MongoDB in my development environment with no worries, but I'm worried about security with a public server.

My server is a VPS running Arch Linux. The web application will also be running on it, so it only needs to accept connections from localhost. And no other users(by ssh or otherwise) will have direct access to my server.

What should I do to secure my instance of MongoDB?

share|improve this question

3 Answers

up vote 3 down vote accepted

Mongo supports only very basic security:

  • configuring authentication. Create user with strong password(one username and password in the database context)
  • bind MongoDB to 127.0.0.0(the loopback interface)
  • change default port
share|improve this answer
If my server will not be accessed by users, then should I still configure the authentication? – Earlz Feb 20 '11 at 5:27
Yes, because vps with website isn't trusted environment. Running Mongo without authentication only for development. – ooshro Feb 20 '11 at 5:34
ok yea that makes sense in case my server is somehow compromised, minimize damage. I'll give this question a couple more hours to see if anyone else has any interesting input – Earlz Feb 20 '11 at 5:35

Security and Authentication MongoDB documentation.

share|improve this answer

same query has been well discussed here ~ http://security.stackexchange.com/questions/7610/how-to-secure-a-mongodb-instance/7655#7655

Few very initial things to remember are:

Remove IP Binding from all to just the IP (private or localhost), you expect to get Connection Request
Change the default Port Bindings
Give only required permissions (like no update/delete permissions to select query users)
Setup ssh keys for required master-slave connection, removing involvement of passwords
You can even setup an encrypted tunnel for connection between your application and mongodb

actually they are applicable on all DataStorage Services

PS: very limited mongodb experience

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.