Last active
April 26, 2016 13:20
-
-
Save ferki/eefe824f42c1254594a5 to your computer and use it in GitHub Desktop.
ssh tunneling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', '[email protected]' ); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 onjump.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.