Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Establishing SSH tunnel and opening another SSH connection through it

by tehcook (Initiate)
on Feb 07, 2012 at 19:06 UTC ( [id://952328]=note: print w/replies, xml ) Need Help??


in reply to Re: Establishing SSH tunnel and opening another SSH connection through it
in thread Establishing SSH tunnel and opening another SSH connection through it

Thanks for pointing me at ProxyCommand. This is pretty close to JavaFan's suggestion, only wrapped into perl code vs ssh config.

One thing I've been wondering about is why one can't pass -L port:host:port to the master ssh. I've tried it with Net::OpenSSH and -L was not passed to the master ssh. Besides a small security concern with that open forwarded port I feel it would be cleaner than proxying via ssh and having to install netcat.

Replies are listed 'Best First'.
Re^3: Establishing SSH tunnel and opening another SSH connection through it
by salva (Canon) on Feb 08, 2012 at 07:25 UTC
    If you have tunnels enabled on the gateway, you can use Net::OpenSSH tunnel methods to create a connection to some remote machine accesible from the gateway without the need to create a local listener.

    For instance:

    my $ssh_g = Net::OpenSSH->new($gateway); my $proxy_command = $ssh_g->make_remote_command({tunnel => 1}, $host, +22); my $ssh = Net::OpenSSH->new($host, master_opts => [-o => "ProxyCommand +=$proxy_command"]);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://952328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found