On 3/16/23 02:53, Jose David Bravo A wrote:
Hello,
Is there any way to record a SSH session, like script/replayscript
functionality but using libssh?
If that's not a functionality that the lib has, may you please point me
in the direction of how this can be implemented, for example using
ssh_client.c ?
There is no functionality for this in libssh. There are several
standalone tools, for example tlog (which is nicely integrated in RHEL).
It really depends on your use case, if you want to record it on the
client or on the server or if you have some pre-existing tools or
formats for storing recordings.
If you are up to the client, the ssh client example is using connectors
for the IO handling. To plug the recording in, I think you can create
your own callbacks that would do the logging and call the default
callbacks (or reimplement them as they do not look like part of the API):
https://gitlab.com/libssh/libssh-mirror/-/blob/master/examples/ssh_client.c#L206
Regards,
--
Jakub Jelen
Crypto Team, Security Engineering
Red Hat, Inc.