Reputation: 7737
I'm running MongoDB in an untrusted environment (everything on the machine running the single mongod instance is trusted, everything else is not). As a result, I only want things running locally to connect to the mongod instance. Is there a way to prevent MongoDB from accepting any remote connections, or even better, opening a port that others could attempt to connect to?
If the typical solution to this kind of problem is not MongoDB-specific (ie it relies on OS configuration), I am running on a *nix system.
Upvotes: 2
Views: 1731
Reputation: 4791
From http://docs.mongodb.org/manual/reference/configuration-options/:
bind_ip
Default: All interfaces.Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. You may attach mongod or mongos instances to any interface; however, if you attach the process to a publicly accessible interface, implement proper authentication or firewall restrictions to protect the integrity of your database.
Setting that to an address that's only internally accessible (or in extreme, only accessible by processes on that host, ex 127.0.0.1
) will likely do what you want.
Upvotes: 6