Conversation
|
I have a draft for using this to implement ssh agent forward in wezterm: wezterm/wezterm#5345 |
b5402f5 to
281fded
Compare
wez
left a comment
There was a problem hiding this comment.
Thanks for this! I'd love to be able to use agent forwarding with wezterm!
I think there are some smallish tweaks that are needed to make this safe
|
Thanks for the review! I've addressed most comments, but have further comments on the safety discussion.
Edit 2: nvm, c_unwind is not in stable yet. |
a6df87b to
9b92bfc
Compare
channel_open_request_auth_agent_callback is required for implementing ssh agent forward as unlike X11 forward, there is no other way to establish a forwarding channel. In libssh: 1. Callback is triggered while handling protocol packets in other libssh call. 2. The callback creates a new channel and prepare for bidirectional forwarding between it and ssh agent. 3. The callback then returns a borrow of the newly created channel for libssh to make reply to the remote side. However, the callback-based flow does not really fit our Rust binding design: during callback we have SessionHolder locked, so it's really hard to do anything without introducing lock re-entrancy issues, plus that it demands us to return a temporary borrow of something owned by Rust side whose lifetime is tricky to model. Instead, we try to turn the callback-based style back to something resembling `ssh_channel_accept_x11` by buffering pending channels and let users fetch them later in a saner context.
|
Thank you! |
|
Published to crates.io as 0.3.1 |
|
I'd also love to see agent forwarding in WezTerm, but small side-note that the Windows OpenSSH agent (and specifically |
channel_open_request_auth_agent_callback is required for implementing ssh agent forward as unlike X11 forward, there is no other way to establish a forwarding channel.
In libssh:
However, the callback-based flow does not really fit our Rust binding design: during callback we have SessionHolder locked, so it's really hard to do anything without introducing lock re-entrancy issues, plus that it demands us to return a temporary borrow of something owned by Rust side whose lifetime is tricky to model.
Instead, we try to turn the callback-based style back to something resembling
ssh_channel_accept_x11by buffering pending channels and let users fetch them later in a saner context.