Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

I would suggest adding the following two rules first.

/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.