russh icon indicating copy to clipboard operation
russh copied to clipboard

No channel handle for Agent Forwarding?

Open aSapien opened this issue 4 months ago • 0 comments

Hi,

I'm writing an SSH jump host which should support agent forwarding. From my understanding, in order to support this functionality I need to do the following:

  1. Listen on russh::server::Handler::agent_request and call session.channel_open_agent() from the server to inform the client about an intention to use the agent.
  2. Server receives a ChannelId of the agent channel in the handler.
  3. Client server_channel_open_agent_forward handler is called, and should be ready to use the channel with an agent (receives russh::Channel<russh::client::Msg>)
  4. Server initializes an AgentClient to use in client.authenticate_publickey_with(..., ..., ..., &mut agent_client) to authenticate to the upstream.

The problem I'm facing is that in order to initialize an AgentClient on the server I need to provide an AgentStream, for which I seem to need a ChannelStream of the agent channel. However, I can't find a way to get the handle (Channel<Msg>) of the agent channel on the server. Only the ChannelId, which I can't use.

Can you provide some guidance? Perhaps I'm approaching this from the wrong angle?

aSapien avatar Aug 20 '25 05:08 aSapien