Provide a callback to handle communications between libssh and the SSH Agent

Currently libssh handles opening a unix socket to the SSH Agent and getting data to/from the agent for authentication. This is a significant problem on Windows because:

  • Unix sockets have only been supported on Windows since Windows 10 v1803, while LibSSH works on at least Windows releases as old as Windows XP
  • All SSH agents on Windows appear to prefer Named Pipes or some other communications mechanism (eg, Pageants memory-mapped files). The SSH agent that comes with windows supports named pipes only.
  • Only a single SSH agent appears to support Unix sockets (Pageant), but it require special work on the users part to start Pageant with command line parameters and set SSH_AUTH_SOCK to where ever they tell Pageant to put the socket (Pageant does not set this environment variable)

This situation has led to developers on Windows maintaining libssh patches for a decade (#45) to provide support for PuTTYs Pageant.

Providing callbacks would appear to be the easiest solution to this long standing problem. No windows-specific code is required and libssh can continue supporting only Unix sockets, while allowing applications consuming libssh on Windows to support whatever communications mechanisms are needed. For applications supporting agent-forwarding this wouldn't even add a lot of code; libssh implements agent-forwarding using callbacks leaving it up to the application to open a connection to the SSH agent and pass data between the agent an an SSH channel.

Edited Oct 14, 2024 by David Goodwin
Assignee Loading
Time tracking Loading