LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-28-2011, 10:52 AM   #1
wyattisimo
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
how to configure iptables to allow ssh tunneling?


I set up a very simple web server running a MySQL database. Before I enabled the firewall, I could connect to the database over an ssh tunnel with no problems.

After I enabled the firewall, ssh tunneling broke. I've got ports 22 and 80 open, as shown below. If I change the INPUT policy to ACCEPT, ssh tunneling works fine.

Does anyone know how to configure iptables to allow ssh tunneling? Do I need to specify some sort of forwarding rule to the local machine? Any help is appreciated!

Here are my current iptables policies and rules:
Code:
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www 

Chain FORWARD (policy DROP)

Chain OUTPUT (policy ACCEPT)
 
Old 04-28-2011, 11:10 AM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
you (sshd) need to connect mysql, even loopback interface connection(assuming you make local port forward to 127.0.0.1:mysqlport) counts as one. So you either allow all loopback traffic by interface name or some ports if you have more strict policy.
 
Old 04-29-2011, 12:24 AM   #3
wyattisimo
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
Could you be more specific? I'm kind of a n00b when it comes to iptables and firewalls in general. How exactly should I define the rule? I would like the ssh tunnel to work for any traffic, not just mysql.
 
Old 04-29-2011, 12:52 AM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Code:
iptables -A INPUT -i lo -j ACCEPT
 
Old 05-02-2011, 05:21 PM   #5
wyattisimo
LQ Newbie
 
Registered: Apr 2011
Posts: 3

Original Poster
Rep: Reputation: 0
ah, makes sense. That seems to do what I want. Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Configure IPtables to Only Allow VNC over SSH debianfan Linux - Security 12 04-18-2010 07:29 AM
More ssh tunneling mortalic Linux - Networking 4 02-25-2009 01:37 AM
libipq, iptables, tunneling Connor.Poske Linux - Networking 0 07-01-2008 01:24 PM
help with ssh tunneling rafa_gallego Linux - Networking 1 01-22-2008 10:45 AM
tunneling thru ssh c9876543210 Linux - Networking 1 07-21-2005 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration