-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SSH agent forwarding #2303
Comments
Can be added using paramiko agent. @erikjensen: in the meantime, you can use |
paramiko rocks, adding agent forwarding support is as simple as adding adding This should be an option, off by default, but we should honour ssh-config. |
2019-05-31 10:04:16: antoine uploaded file
|
According to the documentation, the code in the patch above should do the job but I can't see anything in the environment that would tell applications about the forwarded agent. (no So I'm out of ideas. |
I must have tested wrong. With the two commits above, one can enable agent forwarding with paramiko. XPRA_SSH_AGENT=1 xpra start ssh://host/ --start=xterm or xpra start --ssh=paramiko:agent=on ssh://host/ --start=xterm One important caveat though: this feature works for ssh start (ie: the command lines above), but not for |
The way to support ssh agent forwarding is via the symlink-to-socket technique:
I'm pretty sure the symlink-to-socket technique will work because I've seen it used successfully with other persistent remote access programs, and because I've sort-of implemented the same with xpra by wrapping programs I start with a script that fiddles with It occurs to me I could try to symlink to the |
It occurred to me that I could leverage xpra's --remote-xpra flag to implement the symlink-to-socket technique.
|
@Martin-Buchholz Excellent idea! The commit above works for local connections, even without using ssh. Caveats:
TODO:
|
I forgot to test with other / older client and caused a regression: 8c52d48 |
Thanks! This prompted me to finally create one of those new-fangled openssh keys that are partially stored on my yubikey, and check that indeed, those can be forwarded via ssh agent forwarding, including using my temporary but effective workaround. I'm not quite ready to become a real xpra developer and build my own binaries - I'll wait for an upcoming release. |
Starting a session on ls -la /run/user/1000/xpra/10/ssh/
total 0
drwx------. 2 antoine antoine 60 Jul 22 05:18 .
drwxr-x---. 3 antoine antoine 220 Jul 22 05:18 ..
lrwxrwxrwx. 1 antoine antoine 26 Jul 22 05:18 agent.default -> /run/user/1000/keyring/ssh Then after connecting via ssh: $ ls -la /run/user/1000/xpra/10/ssh/
total 0
drwx------. 2 antoine antoine 100 Jul 22 05:22 .
drwxr-x---. 3 antoine antoine 220 Jul 22 05:18 ..
lrwxrwxrwx. 1 antoine antoine 64 Jul 22 05:22 agent -> fca7cd0c711214f519f8003c8b109a91219b876ceeec934f4e3721668601c4a8
lrwxrwxrwx. 1 antoine antoine 26 Jul 22 05:18 agent.default -> /run/user/1000/keyring/ssh
lrwxrwxrwx. 1 antoine antoine 32 Jul 22 05:22 fca7cd0c711214f519f8003c8b109a91219b876ceeec934f4e3721668601c4a8 -> /tmp/ssh-XXXXcNuKn1/agent.873195
I tried to add code to ensure that the dangling ssh agent socket symlink is removed before the connection is closed, but the
There are beta builds here: https://xpra.org/beta Building should be easy: https://github.com/Xpra-org/xpra/tree/master/docs/Build |
* don't cause errors if filename is None (the default) * log backtrace at error level since this should not be happening and is too early to enable ssh debug logging
(or use the default one if no other client is connected)
You talked me into it. I boldly upgraded to My test command was
then exit xterm, then repeat the above,
After shutdown, that directory should be deleted. In main.py, I see:
If we're very lucky, all we need to do is add |
No, we're not that lucky. A few lines further down I see
and that will fail because |
What is the exact error and backtrace? |
The reason I believe that fixing removal of session files is key is because manually removing them fixes it!
The first successful session ends with
while the second session with unset
What is the red-ness trying to tell me? I stared at ssh.py:abort_test for a while, but not enlightened. |
What do you mean exactly by "unset
Red is for errors.
Ah, so you're using the ssh backend rather than the paramiko default.
This can be triggered in a number of ways, it's the end result rather than the cause. |
I mean that experiment A:
Snippet from started xterm:
follow-on experiment B:
Snippet from started xterm:
Snippet from server.log:
I'm surprised by
That's the path on the client host, not the server host. server should not care about the path on the client, and the two paths to SSH_AUTH_SOCK are not expected to match. |
That's used to make things work with other connections, like local socket connections. Anyway, in both cases the log shows:
And this |
I tried a different experiment - creating a server session as before, then killing the client (via Ctrl-C), then re-attaching using
and that worked well - i.e. the ssh agent is working in the xterm via the new socket connection I noticed more than once that my xterm would stop accepting keyboard input (key events with no effect) when left idle for a long time (e.g. one hour), while mouse input continues to work fine. Probably an independent bug? |
Yes, please file a separate ticket for that. |
After today's auto-update to 4.4, I noticed this:
This succeeds, and in the xterm I have my ssh agent, as I can see by If I then terminate the session by exiting from the xterm, and then retry the exact same xpra command, then in the resulting xterm I do NOT have my agent
I poked around and discovered lingering session config files that should probably have been cleaned up. If I delete that directory, ssh agent forwarding works again
|
we end up re-parsing the display string from the socket, but ssh agent forwarding needs the actual X11 display to setup the correct session dir path
and preserve existing display args when generating the proxy command line... except for the display itself, which may get tweaked (sigh)
we end up re-parsing the display string from the socket, but ssh agent forwarding needs the actual X11 display to setup the correct session dir path
and preserve existing display args when generating the proxy command line... except for the display itself, which may get tweaked (sigh)
Sorry about that, there were still a few bugs, especially with the BTW, best to drop |
I changed my local scripts to do that. I probably included the colon to be more consistent with the documented |
Right. And it is also in the documentation... |
This feature is much improved in v5, see changes in #3593 A major source of problems was #3664 (comment) |
so use an extra function argument instead
we may call 'setup_proxy_ssh_socket' from the builtin ssh server
See also #4353 |
Issue migrated from trac ticket # 2303
component: server | priority: minor
2019-05-17 20:03:20: erikjensen created the issue
The text was updated successfully, but these errors were encountered: