Jim Cheetham
2011-08-05 01:56:38 UTC
Hi all,
My google-fu has failed me, and my iptables-fu is not current enough
for this question, much though it pains me to admit.
I have a remote server, running MySQL on localhost:3306 only.
I wish to allow a specific set of other remote servers to connect to
the MySQL service.
(Yes, those db connections come via usernames that are source limited by MySQL).
What I would like to do is to accept incoming connections to eth0:3306
from specific source IP addresses, and pass those connections down to
lo:3306. This sounds like basic DNAT, but it "does not work", and I'm
assuming that's because I need to do some form of SNAT at the same
time, because the lo interface won't accept IP addresses that aren't
in 127/8 (i.e. I see the SYN packet arrive on eth0, but do not see any
traffic on lo).
Does anyone have a solution to this specific scenario? Most solutions
that I've seen are assuming the iptables is the firewall, and the
MySQL server is somewhere in a DMZ, and this works with the simple
DNAT rule on nat/prerouting, but not when talking to 127.0.0.1.
As a workaround, I'm currently runing MySQL on *:3306, and blocking
connections to eth0:3306 from anything except the desired servers.
This is not good, because a failure to load the iptables rules will
leave MySQL exposed to the world. The *NAT solution is much more
'fail-safe' in that respect, which is why I'm interested in it.
-jim
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
My google-fu has failed me, and my iptables-fu is not current enough
for this question, much though it pains me to admit.
I have a remote server, running MySQL on localhost:3306 only.
I wish to allow a specific set of other remote servers to connect to
the MySQL service.
(Yes, those db connections come via usernames that are source limited by MySQL).
What I would like to do is to accept incoming connections to eth0:3306
from specific source IP addresses, and pass those connections down to
lo:3306. This sounds like basic DNAT, but it "does not work", and I'm
assuming that's because I need to do some form of SNAT at the same
time, because the lo interface won't accept IP addresses that aren't
in 127/8 (i.e. I see the SYN packet arrive on eth0, but do not see any
traffic on lo).
Does anyone have a solution to this specific scenario? Most solutions
that I've seen are assuming the iptables is the firewall, and the
MySQL server is somewhere in a DMZ, and this works with the simple
DNAT rule on nat/prerouting, but not when talking to 127.0.0.1.
As a workaround, I'm currently runing MySQL on *:3306, and blocking
connections to eth0:3306 from anything except the desired servers.
This is not good, because a failure to load the iptables rules will
leave MySQL exposed to the world. The *NAT solution is much more
'fail-safe' in that respect, which is why I'm interested in it.
-jim
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug