LinuxQuestions.org
Help answer threads with 0 replies.
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 08-11-2003, 03:18 AM   #1
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Rep: Reputation: 30
Can't ssh to external ip....please help...


Here's the message I get when I try to connect to my comp through my external ip....

ssh_exchange_identification: Connection closed by remote host

Here's my iptables:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Lokkit-0-50-INPUT - [0:0]
-A INPUT -j RH-Lokkit-0-50-INPUT
-A FORWARD -j RH-Lokkit-0-50-INPUT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
-A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -s 192.168.0.1 --sport 53 -d 0/0 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -j REJECT
COMMIT

This is what nmap tells me:
(The 99 ports scanned but not shown below are in state: closed)
Port State Service
22/tcp open ssh

Is there anything else I may not be setting that's causing this? Thanks.

-Keerthan
 
Old 08-11-2003, 04:00 AM   #2
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
You could try 2 things,

first, SSH to your comp from the same comp, and see what happens.

second, I can see that only SYN is allowed to the SSH port, doesn't ACK need to be allowed as well ? or if you don't want to be so granular, just open the port without checking TCP flags.

just a thought.

Last edited by jalal; 08-11-2003 at 04:21 AM.
 
Old 08-11-2003, 04:48 AM   #3
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Original Poster
Rep: Reputation: 30
I tried connecting to my comp. earlier...that was the error I put up....everything works on LAN i have here....just not working through the external IP....I took off the tcp flags as you said, but still a no-go when I tried connecting.

About the flags, I understand that the TCP packet can contain SYN packets, ACK packets, A FIN packets, and RST packets...client sends SYN packet....my comp is supposed to send an ACK packet for acknowledgement...and then A FIN packets are sent from both sides(or maybe just one?) to finalize communication...and the RST packet is sent from mine to the client if they are rejected...Am I understanding this correct? Please correct me if I'm out there on this. Thanks.
 
Old 08-11-2003, 05:18 AM   #4
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
what I meant is that you could try connecting locally "ssh user@localhost" and see what happens.

As for the TCP, it's: client->SYN, server->SYN/ACK, and client then -> ACK. FIN is to close the session by either the client and server.
 
Old 08-11-2003, 04:53 PM   #5
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Original Poster
Rep: Reputation: 30
I'm assuming you mean try to connect on my local network....everything locally works....Any comp on the LAN can ssh to my comp.....its just trying to get it to work with the external ip. Gives some sort of a timed out error I think......Anything else that could be causing this? Thanks again.

-Keerthan
 
Old 08-11-2003, 07:55 PM   #6
pjcp64
Member
 
Registered: Dec 2002
Location: Omaha, NE
Distribution: Ubuntu Server and SuSE
Posts: 69

Rep: Reputation: 15
I found the following by googling.

http://www.snailbook.com/faq/libwrap-oops.auto.html

You can find others out there too, but here are a few suggestion I'd try as well.

*** before modifying any of the following files, make sure you create a backup of it. I'd also log your steps to ensure that you can backtrack.

I'd try the following:

Since you're using RH-Lokkit I'm assuming your firewall is the RedHat firewall: "System Settings"-->"Security Level" and make sure that the SSH option is available. You could also reduce the firewall setting temporarily to see if it works ( assuming that it's prudent for the data on your system ).

Use the -v option for verbose mode to help debug the problem ( e.g. ssh -v hostname )

Verify that your /etc/hosts.allow and /etc/hosts.deny are not causing the problem.

If you're using keys, revert to using a good ole login/password until you get the problem resolved.

It's never a bad idea to ensure that it isn't a DNS issue by placing an entry for the client system in the host's /etc/hosts file.
 
Old 08-12-2003, 01:08 AM   #7
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Original Poster
Rep: Reputation: 30
Thanks a bunch pjcp64....did a -v ....it connected but then dropped the connection after checking some identity files...so i checked the hosts.deny file and that was the problem. It works fine now!

I was wondering what commands I could use to drop all of the users connected....or manage them somehow....
 
Old 08-12-2003, 05:51 AM   #8
pjcp64
Member
 
Registered: Dec 2002
Location: Omaha, NE
Distribution: Ubuntu Server and SuSE
Posts: 69

Rep: Reputation: 15
Could you elaborate a little on what you mean by dropping and managing?

For instance, do you want only specific users to be able to SSH into your box, or only specific IP Addresses? Or both?

As far as dropping the users, you can kill their jobs:

ps -ef | grep ssh
and for each of the PIDs you want to kill do a
kill <PID>
 
  


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
cannot ssh to external interface CartersAdvocate Slackware 12 11-17-2005 08:53 PM
ssh connection refused for external IP's Pleonast Linux - Networking 2 11-08-2004 12:00 PM
ssh not working on external IP TurboChicken Linux - Newbie 17 08-05-2004 06:19 PM
SSH to an external IP address BluePyre Linux - Software 2 07-14-2004 06:10 PM
Cannot ssh into Linux with external ip address gautam1980 Linux - Newbie 1 02-13-2004 02:14 PM

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

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