Skip to content

Instantly share code, notes, and snippets.

@pid
Created July 31, 2013 07:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pid/6119939 to your computer and use it in GitHub Desktop.
Save pid/6119939 to your computer and use it in GitHub Desktop.
Firewall iptables config example securing access to mongodb
iptables -N MongoDB
iptables -I INPUT -s 0/0 -p tcp --dport 27017 -j MongoDB
iptables -I INPUT -s 0/0 -p tcp --dport 28017 -j MongoDB
iptables -I MongoDB -s 127.0.0.1 -j ACCEPT
iptables -I MongoDB -s 10.0.0.1 -j ACCEPT
iptables -I MongoDB -s 10.0.0.2 -j ACCEPT
iptables -I MongoDB -s 10.0.0.3 -j ACCEPT
iptables -A MongoDB -s 0/0 -j DROP
/etc/init.d/iptables save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment