There's something really broken about my mental model of how ssh's nesting of ProxyCommand works.
I have the following ssh command that works the way I want it to (ssh to jump.mydomain.com and then once I'm on jump.mydomain.com I ssh (using ProxyCommand) to server.remote.com.
ssh -t local_me@jump.mydomain.com \
ssh -o "ProxyCommand='cloudflared access ssh --hostname %h'" \
remote_me@server.remote.com
I feel like I should be able to set up some rules in my local ~/.ssh/config file so that I can just type
ssh remote_me@server.remote.com
and have these multiple steps "just work", but I can't figure out what those rules should be.
I think my question might be a duplicate of ProxyCommand use for multiple hops and prompt authentication prompt-authentication, but in that question the proxycommands are all being used for simple hops, and my proxycommand doesn't seem to fit into either end of the chain.
ssh_config(3)
for howProxyCommand
works. the client simply uses a pipe to establish the ssh connection, instead of starting a tcp connection itself. i think your solution is the only clean solution, i was thinking ofProxyJump
but it works with port forwarding and doesn't allow to force using a command (such ascloudflared
). – don_aman Mar 16 '23 at 21:07ProxyCommand
can be built by observing how one can use it to achieve what goals. I have a nice example here: How to throttle bandwidth of SSH connection. – Kamil Maciorowski Mar 16 '23 at 21:14ssh_config(5)
. It'sman 5 ssh_config
. – Kamil Maciorowski Mar 16 '23 at 21:22