LinuxQuestions.org
Visit Jeremy's Blog.
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 10-27-2005, 02:05 PM   #1
Charles Daniel
Member
 
Registered: Aug 2004
Location: Missouri City, Tx
Posts: 39

Rep: Reputation: 15
Help with ssh


I have iptables working so far for my Web Server, DNS, HTTPS and Game Server. However setting it up for other services is getting to be problematic. First I tried to set up a ruleset for VSFTP. I never got it to work. Now I've decided to forego the ftp server and run SSHD.

In both cases I have tried to setup rudamentory rules for these services (FTP and SSH) in much the same way I did for my other services (HTTP, HTTPS, DNS). I expected at least the SSH server to require rules similar in construct to HTTP/TCP servers.

Here are my rules:
# Enable tcp server from port 22
iptables -A INPUT -i $IFACE -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -o $IFACE -p tcp --sport 22 -j ACCEPT

# Allow tcp client on port 22
iptables -A INPUT -i $IFACE -p tcp --sport 22 -j ACCEPT
iptables -A OUTPUT -o $IFACE -p tcp --dport 22 -j ACCEPT

These rules are similar to what I have for my web server as illustrated below:

# Allow internet browsing
iptables -A INPUT -i $IFACE -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o $IFACE -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

# Enable HTTP server
iptables -A INPUT -i $IFACE -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o $IFACE -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

So why dont they work?

Thanks
 
Old 10-27-2005, 02:23 PM   #2
Dudydoo
Member
 
Registered: Sep 2003
Location: UK
Distribution: I use 'em all ;-)
Posts: 275

Rep: Reputation: 38
Are they the only rules that you have got set? Because if not, maybe a rule further up the chain is blocking the connection before it get's to the SSH one's.


Also, what I would first try stopping iptables and see if you can connect to the SSH service without a firewall, just to make sure that is working.

You're rules above look fine to me.
 
Old 10-27-2005, 04:27 PM   #3
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
I think you're making some unwarranted assumptions about the source ports. Your SSH server listens on port 22, but I don't think it has to respond on port 22. So your OUTPUT rules may be keeping you from establishing a connection. To be honest, I have very few rules on my OUTPUT chain other than allowing NEW, ESTABLISHED and RELATED traffic. I don't have any server specific rules.
 
  


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
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 09:25 AM
Mac OS X ssh client / linux sshd : ssh hangs/disconnects Apollo77 Linux - Networking 1 05-24-2006 11:53 AM
I turned off SSH, but I cant get it back! How do you start SSH on boot? nmoog Slackware 2 02-08-2004 05:18 PM
ssh issue: /usr/bin/ssh -x -oFallBackToRsh no -l WeNdeL Linux - Software 1 03-04-2003 07:17 PM

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

All times are GMT -5. The time now is 01:24 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