How to disable TCP port of MongoDB?

How to disable TCP port?

Configure only a Unix socket.

To isolate local users.

+4
source share
2 answers

I understand that your problem is related to the security in your setup, but you should think that MongoDB is built by design for interoperability in cluster systems, and therefore the TCP network is part of this project. However, and as you know, the default is to use a unix domain socket connection, which you can use for local access.

"-bind_ip" loopback ( "127.0.0.1" ) , , mongod . , , .

.

+1

, , 5- . , , WONTFIX RTFM, , 2.4 , : https://jira.mongodb.org/browse/SERVER-9383.

MongoDB unix, IP- IPV4 127.0.0.1 0.0.0.0. ( , ). MongoDB.

2011 , , , 2 mongodb, . 192.168.1.1:27017 192.168.1.2:27017, :/tmp/mongod-27017.sock. 10gen , , 2011 . , 127.0.0.1:27017 , - EADDRINUSE, , . , -.

: https://github.com/mongodb/mongo/blob/r2.2.4/src/mongo/util/net/listen.cpp#L91

if (useUnixSockets && (sa.getAddr() == "127.0.0.1" || sa.getAddr() == "0.0.0.0")) // only IPv4
               out.push_back(SockAddr(makeUnixSockPath(port).c_str(), port));
+1

Source: https://habr.com/ru/post/1524204/


All Articles