3 ms·
A fun read in a similar vein: the mosh (https://mosh.mit.edu/ https://mosh.mit.edu/) issue regarding adding support for SSH agent forwarding: https://github.com
by derefr 12y ago
A fun read in a similar vein: the mosh (https://mosh.mit.edu/ https://mosh.mit.edu/) issue regarding adding support for SSH agent forwarding: https://github.com/keithw/mosh/issues/120 https://github.com/keithw/mosh/issues/120
- thaumasiotes 12y agoI see a lot of people demanding that mosh add a security hole because they don't know the secure way of doing what they want to do. (It's also quite possible that I'm just misunderstanding the whole thing.) But it's pretty easy to see where the real problem is. I recently spent a few days trying to figure out how I could configure SSH to connect to one machine via a different machine. (This effort was a total failure.) I read the ssh_config man page. Here's the entry for ProxyCommand, which is apparently how you do this: ProxyCommand Specifies the command to use to connect to the server. The com- mand string extends to the end of the line, and is executed using the user's shell `exec' directive to avoid a lingering shell process. In the command string, any occurrence of `%h' will be substituted by the host name to connect, `%p' by the port, and `%r' by the remote user name. The command can be basically anything, and should read from its standard input and write to its standard output. It should eventually connect an sshd(8) server running on some machine, or execute sshd -i somewhere. Host key manage- ment will be done using the HostName of the host being connected (defaulting to the name typed by the user). Setting the command to ``none'' disables this option entirely. Note that CheckHostIP is not available for connects with a proxy command. This directive is useful in conjunction with nc(1) and its proxy support. For example, the following directive would connect via an HTTP proxy at 192.0.2.0: ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p I think it's fair to say that this is completely incomprehensible. I've read it several times; I still can't say I understand any part of it (all right, I understand the bit about %h, %p, and %r substitutions). It doesn't surprise me at all that nobody uses ProxyCommand -- how are they supposed to know what it does, or how it's used? I might also note that this "correct" solution involves telling ssh to execute the nc command on the middle machine, which is a weird bit of arcana to add to the process and makes it much harder to intuit independently. Ideally, I'd hope for a solution that lets me just supply credentials and information for the middle machine, and let ssh sort out how to get through it.
- derefr 12y agoIt occurs to me that all this would be much simpler/more elegant if ssh wasn't trying to be a dumb pipe, but instead something more like "tmux where some sessions can be remote". * Both servers and clients would have an "SSH session-manager daemon" running. * New terminals would preferably invoke just "ssh" as their shell, which would create a connection to the local SSH session-manager server—the same way people tend to use tmux under desktop Linux. * The ssh(1) command would be able to talk to the session control channel of whatever session it's being run in, and say things like "hey SSH client, make a new session connected to this remote!" (Again like tmux.) * The remote side would be running an SSH session-manager daemon too, so when you are in a session connected to hostA and you type "ssh hostB", the remote session manager daemon of hostA would set up a TCP-forwarding channel within itself, provide the new channel's ID over the control-channel back to the connected client, and the connected client would then create a new session connected to the TCP-forwarding channel. Actually, now that I think about it, this is pretty much exactly like using Erlang's job control with remsh connections.
- thaumasiotes 12y agoI appreciate SSH's ability to work as a dumb pipe. Tunnels are a boon to my life. What I really, really want is for the SSH documentation to make sense even to people who don't already know what it means. If I know what I want to do, and SSH provides a way of doing that exact thing, I don't think it's too much to ask for the documentation to be good enough that I recognize the thing I want when I read about it. As things currently stand, the ProxyCommand documentation is only helpful at all if you already know all about ProxyCommand.
- derefr 12y agoYou could have both. Just like there's both ssh(1) and scp(1), you could have snc (heck, that probably already exists.) But I don't see why SSH itself has to be constrained by being both a dumb pipe and a client/server shell system. Shells are complicated things, remote shells even moreso, and requiring them to also be able to serve as dumb pipes constrains the way you implement the shell stuff—it pokes a hole in the abstraction. (If it were all up to me way back when, I'd have just cleaned up the TTY-device abstraction, merged it with PTTYs and serial consoles, made the whole thing socket-routable at the kernel level... and then pushed IPSec to ship with a very SSH-like auto-negotiated pairing protocol. We have the worst of a lot of worlds.)