0

I'm trying to setup a mongodb in a FreeBSD jail. I found in the documetation that I can set the bind_ip to 127.0.0.1 to allow only access from localhost. But when I check with sockstats it's bound to my jail ip and not to localhost.

sockstats -l46

mongodb mongod 86661 6 tcp4 10.0.0.1:27017 *:*

My mongodb config

port = 27017
bind_ip = 127.0.0.1 # do not communicate with the external world
maxConns = 100 # you may want more
objcheck = true
dbpath = /var/db/mongodb
noauth = true

So my question is why is that bound to 10.0.0.1 and not to 127.0.0.1?

1

You probably need to add 127.0.0.1 to the jail, as jails will forbid binding to anything but the jail ip.

But, if you want to confine mongo just to the jail, maybe a better idea would be to firewall it ... using 127.0.0.1 in jail could be wrong from security point of view.

2
  • With firewall it you mean something like a pf rule to allow access to the mongodb instance only from the jail ip? May 15 '15 at 9:49
  • Yes. Or you could add another loopback with different ip allowed in the jail ...
    – Fox
    May 15 '15 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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