Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Multilevel SSH

by salva (Abbot)
on Oct 17, 2012 at 07:49 UTC ( #999475=note: print w/replies, xml ) Need Help??


in reply to Multilevel SSH

You can use Net::OpenSSH and Net::OpenSSH::Gateway. The later is not on CPAN yet because I am not completely happy with its internals, but otherwise it is completely functional.

Once installed, you can run:

my $ssh = Net::OpenSSH->new($target, gateway => { proxies => ['ssh://serverA', 'ssh://serverB'] +}); my $output = $ssh->capture('ls');
Under the hood it uses several tricks to find a way to jump from one hop to the next, as creating tunnels or running any of socat, netcat or perl.

Replies are listed 'Best First'.
Re^2: Multilevel SSH
by grantm (Parson) on Oct 18, 2012 at 02:14 UTC
    Under the hood it uses several tricks to find a way to jump from one hop to the next, as creating tunnels or running any of socat, netcat or perl.

    I learned recently that the latest versions of OpenSSH support -W host : port to do what historically we've done with socat/netcat.

      I know, I requested it :-)

      Net::OpenSSH::Gateway already supports it but -W requires port forwarding to be enabled on the server and, in my experience, that feature is frequently disabled in ssh gateways for security reasons.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999475]
help
Chatterbox?
[ambrus]: As for TeX, I'm not trying to discourage anyone from writing carefully beautifully typeset documents, in maths or outside. But most people aren't willing to do that, and will spend only little time about the formatting,
[ambrus]: and try to leave everything else to automated systems without checking how what they write came out format-wise, and for those people, discounting the part about journals with a specific format above,
[ambrus]: just blindly recommending to use LaTeX is a bad idea now.

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2017-09-26 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (293 votes). Check out past polls.

    Notices?