Alex Rivera | Logout

MongoDB Security

Asked 2011-11-27T15:50:11.107
8

I'm looking for "Security Best Practices" for a MongoDB Server, apart from "general" server's security best practices. Could you point me to useful resources?

Edit
Report

1 Answer

10

What basically needs to be done is

Enable Authentication

Open mongoDB shell

use admin
db.addUser("admin","adminpassword")

( IMPORTANT: you will need an admin user before you enable authentication, or else you will loose access to data ).

Now edit the mongodb config file sudo vi /etc/mongodb.conf

and uncomment auth=true. Save it and restart mongo db sudo service mongodb restart

Bind mongoDB to trusted network or machine

Edit mongoDB config file and add bind_ip = 127.0.0.1 or a comma separated list of IPs that will be able to connect to mongoDB. Then restart.

For more information you can find a guide to do these on my website here

answered 2012-11-28T08:21:41.393

Your Answer