0

What is the clientSource and serverAddress to be used. How to find the value of it to be used?

How the values can be tried in localhost ?

  • If you don't know these addresses, then you should/cannot use them. I suggest to use `net.bindIp: localhost` (or `--bind_ip localhost` - which is the default). Then you can connect only from the machine where your MongoDB is running. Using `serverAddress` makes only sense, when you run a replica set or sharded cluster. – Wernfried Domscheit Jun 05 '23 at 06:59
  • My intention is to let the Mongodb connection happen only from app server to db server. clientSource should be the app server ip address and what should be the serverAddress ??? @WernfriedDomscheit – user2527732 Jun 05 '23 at 08:20
  • Can we use any values we view in ipconfig ? – user2527732 Jun 05 '23 at 08:27
  • This you should implement with firewall rules. With `clientSource` you can forbid a certain user to connect from different host, but a hacker could simply try a different username. And as said, a `serverAddress` does not make any sense when you have just one DB server, because there is no other server where you could block any connection. – Wernfried Domscheit Jun 05 '23 at 09:18
  • Planning to create only a single user and restrict it's access only from app server. serverAddres expect the db server ip right?@WernfriedDomscheit – user2527732 Jun 05 '23 at 11:40
  • Correct. `serverAddress` could be used for example to block connection to a delayed or hidden replica set member. "Planning to create only a single user" - how do you like to administrate the server in this case? – Wernfried Domscheit Jun 05 '23 at 11:56

0 Answers0