title: protect mongodb ports with iptables
body: <p>This is my iptables config:</p>
  
  <pre><code>sudo iptables -L -v
  Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
   pkts bytes target     prot opt in     out     source               destination         
      0     0 ACCEPT     all  --  lo     any     anywhere             anywhere            
    859  103K ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
      5   260 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh
      3   230 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:27017
      4   208 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:28017
      0     0 ACCEPT     all  --  any    any     localhost            anywhere            
      0     0 ACCEPT     all  --  any    any     111.111.111.111      anywhere            
      0     0 ACCEPT     all  --  any    any     222.222.222.222      anywhere            
     64  3844 DROP       all  --  any    any     anywhere             anywhere            
  
  Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
   pkts bytes target     prot opt in     out     source               destination         
  
  Chain OUTPUT (policy ACCEPT 764 packets, 227K bytes)
   pkts bytes target     prot opt in     out     source               destination         
      0     0 ACCEPT     all  --  any    any     localhost            anywhere            
      0     0 ACCEPT     all  --  any    any     111.111.111.111      anywhere            
      0     0 ACCEPT     all  --  any    any     222.222.222.222      anywhere
  </code></pre>
  
  <p>If I write in browser the ip if my mongodb server with port 28017, I can see a promt to enter username and password:</p>
  
  <pre><code>#ip mongodb server
  000.000.000.000:28017
  </code></pre>
  
  <p>I want close mongodb ports to anyone except to these 2 ips:</p>
  
  <pre><code>111.111.111.111
  222.222.222.222
  </code></pre>
  
  <p><strong>How can I do it?</strong></p>