russh
russh copied to clipboard
No channel handle for Agent Forwarding?
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:
- Listen on
russh::server::Handler::agent_requestand callsession.channel_open_agent()from the server to inform the client about an intention to use the agent. - Server receives a
ChannelIdof the agent channel in the handler. - Client
server_channel_open_agent_forwardhandler is called, and should be ready to use the channel with an agent (receivesrussh::Channel<russh::client::Msg>) - Server initializes an
AgentClientto use inclient.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?