42 points · by jessaustin · 11y ago · 14 comments
ProxyCommand ssh -aY bastion 'nc -w 900 `x="%h"; echo ${x%%.bast}` %p' # dark magicks for hopping hosts. first version
# (you'll need to specify target user name though)
Host *+*
VerifyHostKeyDNS=no
ProxyCommand ssh $(echo %h | sed 's/^\([^+]*\).*$/\1/') nc $(sed -n '/^Host[ \t]*\('$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'\)$/,/^$/{/^.*HostName[ \t]*/{s///; s/[ \t]*$//; h}}; ${x; /./{p; b}; s/^/'$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'/p}' ~/.ssh/config) $(sed -n '/^Host[ \t]*\('$(echo %h | sed 's/^.*+\([^+]*\)$/\1/')'\)$/,/^$/{/^.*Port[^0-9]*/{s///;s/[ \t]*$//;h;};};${x;/./{p;q;};s/^/22/p;}' ~/.ssh/config)http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Ju...
It will never touch any part of the network, or handle any untrusted input. So this is not a concern.