Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Jul 28, 2012 2:27 pm 
Offline
Newbie

Joined: Sat Jul 28, 2012 2:21 pm
Posts: 2
Hi,

I have 2 Linodes (App1 and App2) running a web application behind a NodeBalancer. The two application servers connect to a database server (DB1) though a 2nd NodeBalancer. Both application servers were able to access the database server through the NodeBalancer until I implimented iptables to secure the database server (DB1).

I've included my iptables config below - please could someone help and advise a suitable rule? Would really appreciate your help.

In an attempt to get things working I implemented the "# Allow connections from other Linodes" section with all the Linode IP's but this doesn't seem to have worked.

Code:
*filter

# Allow all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT -i lo -d 127.0.0.0/8 -j REJECT

# Accept all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow all outbound traffic - you can modify this to only allow certain traffic
-A OUTPUT -j ACCEPT

# Allow SSH connections
-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT

# Allow ping
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT

# Log iptables denied calls
-A INPUT -m limit --limit 5/min -j LOG --log-prefix "iptables denied: " --log-level 7

# Allow connections from other Linodes
# External Ip's
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
# Internal Ip's
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
# Balancers
-A INPUT -s IPADDRESSHERE -j ACCEPT
-A INPUT -s IPADDRESSHERE -j ACCEPT
# External Ip's
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
# Internal Ip's
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
# Balancers
-A OUTPUT -s IPADDRESSHERE -j ACCEPT
-A OUTPUT -s IPADDRESSHERE -j ACCEPT

# Reject all other inbound - default deny unless explicitly allowed policy
-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT


Top
   
PostPosted: Sat Jul 28, 2012 6:22 pm 
Offline
Newbie

Joined: Sat Jul 28, 2012 2:21 pm
Posts: 2
Hi,

I've managed to fix this with;

-A INPUT -p tcp -m tcp -s 192.168.0.0/16 --dport 3306 -j ACCEPT

After establishing with Linode support that NodeBalancer IP addressers are not static, but operate within the 192.168.0.0/16 range.

Thanks,
Adam.


Top
   
PostPosted: Mon Jul 30, 2012 3:32 am 
Offline
Senior Member

Joined: Sat May 03, 2008 4:01 pm
Posts: 567
Website: http://www.mattnordhoff.com/
Um... 192.168.0.0/16 also covers the private IPs of every other customer in the data center, and a /17 that isn't used at all. That's a really bad idea. You should ask Linode for a more specific address range that's only used by NodeBalancers -- IIRC they used to be on 192.168.255/24 or so.

_________________
Matt Nordhoff (aka Peng on IRC)


Top
   
PostPosted: Wed Aug 01, 2012 11:01 am 
Offline
Sysop

Joined: Sat Nov 27, 2010 3:32 am
Posts: 180
Website: https://blog.timheckman.net/
Location: San Francisco, CA
mnordhoff wrote:
Um... 192.168.0.0/16 also covers the private IPs of every other customer in the data center, and a /17 that isn't used at all. That's a really bad idea. You should ask Linode for a more specific address range that's only used by NodeBalancers -- IIRC they used to be on 192.168.255/24 or so.


Yes, NodeBalancers do use 192.168.255.0/24.

_________________
'If debugging is the process of removing bugs, then programming must be the process of putting them in.' //Edsger Dijkstra
'Nothing is withheld from us which we have conceived to do.' | 'Do things that have never been done.' //Russell Kirsch


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group