Re:Simplify your life with an SSH config file
by mrud on Saturday October 20, 2012 @03:11PM
(#4677942)
You can also use ssh -W [1] instead of relying on nc, i.e:
Host madeup
Host internal_name
ProxyCommand ssh external.example.net -W %h:22
[1] - http://manpages.debian.net/cgi-bin/man.cgi?query=ssh&apr...
Re:Simplify your life with an SSH config file
by stock_toaster on Saturday October 20, 2012 @04:10PM
(#4678117)
Note there appears to be a bug where the use of ControlPersist breaks the use of '-W'. You end up with 'bad packet'.
openssh-6.0 release notes has this:
* sshd(8): unbreak stdio forwarding when ControlPersist is in use; bz#1943
I haven't tested to see if that resolves the issue yet though (on osx which of course does not have 6.0).However, the netcat version works fine.
Re:Simplify your life with an SSH config file
by ryan-c on Saturday October 20, 2012 @08:11PM
(#4678513)
A generalized version of that:
https://github.com/ryancdotorg/ssh-chain
It will let you do
ssh internal-dev.example.net^external.example.net
Re:Simplify your life with an SSH config file
by HerraBRE on Sunday October 21, 2012 @07:02AM
(#4679441)
I use the same technique to access VPS machines and mobile devices, except instead of a fixed bastion host I relay the connections through PageKite (disclosure: I'm the author). It feels a bit magical to just be able to ssh into a laptop or Android phone, no matter which network it is on. :-)
The PK/SSH HowTo: https://pagekite.net/wiki/Howto/SshOverPageKite/
Re:Simplify your life with an SSH config file
by olalonde on Sunday October 21, 2012 @10:17AM
(#4679748)
Why not directly ssh into "external.example.net"? Why is this a time saver? I'm not sure what you use this for...
Re:Simplify your life with an SSH config file
by luser001 on Sunday October 21, 2012 @11:26AM
(#4679876)
1. Two commands instead of one. :)
2. Scripting an scp, rsync etc from the internal machine is easier now, since the ssh from the external to internal machine is handled transparently for you.
Re:Simplify your life with an SSH config file
by rubyrescue on Sunday October 21, 2012 @11:27AM
(#4679879)
i've seen this used for security, in that you can have an extra external server you must have access to in order to get to internal servers.
Re:Simplify your life with an SSH config file
by olalonde on Sunday October 21, 2012 @12:15PM
(#4679975)
Ah ok, this make sense especially if some of your machines are on the same LAN but don't have an external IP.
e.g.:
Basically, specify as ProxyCommand whatever command needs to be run to give you i/o to the remote sshd - in this case, sshing to a bastion host and running netcat. This allows me to do, for example: Which will (in background) ssh to the bastion host external.example.net. I can even do port forwards to internal hosts using -L or LocalForward directives. It's a huuuuge timesaver.ssh even automatically replaces %h and %p in the ProxyCommand with a host and port, though you can of course replace those tokens with static values if it works better.
(Also, note above that one can use wildcards in Host declarations.)