Skip to content

Instantly share code, notes, and snippets.

@ferki
Last active April 26, 2016 13:20
Show Gist options
  • Select an option

  • Save ferki/eefe824f42c1254594a5 to your computer and use it in GitHub Desktop.

Select an option

Save ferki/eefe824f42c1254594a5 to your computer and use it in GitHub Desktop.
ssh tunneling
use Rex -feature => qw(1.3);
user 'my_user_on_target';
#Rex::Config->set_openssh_opt(
# LocalForward => 'localhost:2222 final.target.host:22' );
task 'runs_on_target', 'localhost:20000', sub {
say run 'hostname';
};
no_ssh before 'runs_on_target' => sub {
LOCAL {
system( 'ssh', '-f', '-N', '-L20000:final.target.host:22', 'user@jump.host' );
}
};
@krimdomu

krimdomu commented Nov 7, 2015

Copy link
Copy Markdown

Doesn't it work with this? http://www.rexify.org/docs/release_notes/0.50.0.html (see jump host)

@ferki

ferki commented Mar 6, 2016

Copy link
Copy Markdown
Author

I'm not sure about the exact details, but my guess is that user is only allowed to forward ports, but does not have an interactive shell on jump.host. At least this kind of SSH tunneling was requested specifically for the use case at hand.
Or maybe using Net::OpenSSH was just simply not on option e.g. running Rex on Windows.

@fr34k8

fr34k8 commented Apr 26, 2016

Copy link
Copy Markdown

on windows, default shell bash could now apply for windows 10.
@krimdomu @ferki some switch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment