5 ms·
# 1st: accept connections from localhost iptables -A INPUT -p tcp -s 127.0.0.1 --dport 27017 -j ACCEPT iptables -A INPUT -p tcp -s 127.0.0.1 --dport 28017 -j
by moozeek 12y ago
# 1st: accept connections from localhost
iptables -A INPUT -p tcp -s 127.0.0.1 --dport 27017 -j ACCEPT
iptables -A INPUT -p tcp -s 127.0.0.1 --dport 28017 -j ACCEPT
# 2nd: drop from all others
iptables -A INPUT -p tcp --dport 27017 -j DROP
iptables -A INPUT -p tcp --dport 28017 -j DROP
- Kudos 12y ago# 3rd: change bind_ip from 127.0.0.1 to whatever in mongod.conf
- stennie 12y agoFYI, the Security section of the MongoDB manual has a checklist (http://docs.mongodb.org/manual/administration/security-checklist/ http://docs.mongodb.org/manual/administration/security-check...) and example firewall configurations for iptables on Linux and netsh on Windows: http://docs.mongodb.org/manual/administration/security-network/ http://docs.mongodb.org/manual/administration/security-netwo....