IPTables configuration for Localhost
Posted
by Gabe Mc
on Server Fault
See other posts from Server Fault
or by Gabe Mc
Published on 2010-06-11T04:32:17Z
Indexed on
2010/06/11
4:43 UTC
Read the original article
Hit count: 383
I have a problem in connecting a JIRA instance running on a cloud server to an instance of MySQL running on the same box. I have configured it previously using quite a few iptables rules, but it seems overly broad/terribly inprecise. I want access to several of localhosts ports from the local machine, but deny it from all other accounts. Currently, my /etc/iptables.rules file looks like:
*filter
:INPUT DROP [223:17779]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10161:1120819]
# SSH Access
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# Apache2 Access for connecting to Tomcat on port 8080
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
# MySQL
-I INPUT -i lo -p tcp -m tcp --dport mysql -j ACCEPT
COMMIT
However, this doesn't allow me to log in when I try logging in; it just hangs on:
#> mysql -u root -p -h 127.0.0.1
The Tomcat servlet container starts throwing all kinds of exceptions, as well.
This is a more general problem, as I need to enable things like accessing the shutdown port for the Tomcat container, but I need to at least get the MySQL part ironed out first, without the ugliness I was originally trying.
Thanks.
© Server Fault or respective owner