Subject: Can a remote TCP/IP server get connection information from libssh2

Can a remote TCP/IP server get connection information from libssh2

From: Jeff Coffler <jeff_at_taltos.com>
Date: Wed, 18 May 2016 15:00:31 -0700

Hi,

I'm working with one of the sample programs, direct_tcpip.c, which uses the
libssh2_channel_direct_tcpip_ex to connect to a remote server via SSH.

That much is working great. I can talk to the server, everything is good.
However, I would like the remote server (which may or may not be receiving
a connection from SSH; it may also receive a connection directly over
TCP/IP without SSH) to:

   1. Determine if the connection is coming in via SSH, and
   2. If coming in via SSH, determine the username and type of
   authentication that was used (password, key, etc). Or, if I can't determine
   the type of authentication, at least determine the username that was used
   to authenticate.

It's not clear to me if this is even possible:

   - The server may not be on the local host (I may connect from host A to
   server B, which connects via TCP/IP to server C, although that leg would
   not be encrypted),
   - For the life of me, I can't figure out a way to take the TCP/IP socket
   from accept() (that's all I've got on the server at the time) and turn that
   into something useful (like a LIBSSH2_SESSION * or something). And even if
   I had a valid session, I can't find an API that would return the username
   that was used to authenticate a session.

Is this sort of integration possible with libssh2?

Thanks in advance for any help!

/Jeff

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-05-19