Register
It is currently Sat Oct 25, 2014 6:39 am

How do I nest these ssh tunnels?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Thu Feb 17, 2011 10:32 pm   

Joined: Thu Feb 17, 2011 6:53 pm
Posts: 2
I'm writing a bash script where I'm trying to chain a series of ssh servers together, then create a second tunnel inside the first one, so the data isn't decrypted between servers. The problem is, after I finish establishing the first tunnel, I'm inside the shell for the last server in the chain. I need to get back to a local bash prompt without closing that first tunnel, so I can run the command for the second tunnel.

I suppose I could open a second window (I'm using Cygwin) and find a way to automatically alt-tab between the two, but that's an awfully clunky solution. I have tried using flags to keep ssh from opening a terminal on the last hop, but that doesn't work- everything just hangs. Any ideas?


Top
 Profile  
 PostPosted: Fri Feb 18, 2011 10:46 am   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
That's interesting! And it should work. Is the intent to get to that last machine and then tunnel directly back to the first machine, or does the reverse tunnel have to to through the original series of tunnels?


Top
 Profile YIM  
 PostPosted: Sat Feb 19, 2011 10:56 pm   

Joined: Thu Feb 17, 2011 6:53 pm
Posts: 2
jeo wrote:
That's interesting! And it should work. Is the intent to get to that last machine and then tunnel directly back to the first machine, or does the reverse tunnel have to to through the original series of tunnels?


Yes, the idea is to create one tunnel that starts at my local machine and ends at the last server in the chain, then create a separate tunnel inside that one that goes straight from my local machine to that last server, so as to preserve data privacy on the hops in between.

The problem is that I can't create that second tunnel because I can't get back to the bash shell running on my local machine. I have to log out of the shell running on the final ssh server, which closes the first tunnel- no good.

Here's a diagram of what the finished connection should look like:

Code:
                Initial Tunnel
My computer -->  Server 1 -->  Server 2 -->  Server 3
              |          Nested Tunnel          |
               ---------------------------------^


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP