You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HostConfigEntry used in SshClient should be forwarded to the to-be-created ClientSession. This can be done via the "connectionContext" AttributeRepository. This one gets passed from the SshClient to the IoConnector, and gets attached to the IoSession that is created. The AbstractClientSession already extracts it from the IoSession and makes it available via getConnectionContext().
So the SshClient just has to add the HostConfigEntry as an attribute there, and the AbstractClientSession can then retrieve that attribute and make it available via a new getHostConfigEntry() convenience method.
Motivation
A client session needs to know the HostConfigEntry, and it needs to know it before it is started. The host entry might contain configurations relevant already for the initial key exchange, such as cipher, mac, or host key signature algorithm settings.
Propagating such information only after the SSH session has been created and started is too late.
Alternatives considered
Setting properties from the host entry somewhere where the to-be-created session can find them. But where? Such properties cannot be set on the session itself since it doesn't exist yet. Setting them on the client won't work because the settings are specific to the new session, but a client can created many sessions. We'd risk using the wrong settings for the wrong sessions.
This extra "connection context" AttributeRepository appears to be the right place, provided the SshClient can make sure it gives each session its own such attribute repository (which is possible).
Additional context
JGit has implemented that years ago in their SSH transport.
The text was updated successfully, but these errors were encountered:
Description
The
HostConfigEntry
used inSshClient
should be forwarded to the to-be-createdClientSession
. This can be done via the "connectionContext"AttributeRepository
. This one gets passed from theSshClient
to theIoConnector
, and gets attached to theIoSession
that is created. TheAbstractClientSession
already extracts it from theIoSession
and makes it available viagetConnectionContext()
.So the
SshClient
just has to add theHostConfigEntry
as an attribute there, and theAbstractClientSession
can then retrieve that attribute and make it available via a newgetHostConfigEntry()
convenience method.Motivation
A client session needs to know the
HostConfigEntry
, and it needs to know it before it is started. The host entry might contain configurations relevant already for the initial key exchange, such as cipher, mac, or host key signature algorithm settings.Propagating such information only after the SSH session has been created and started is too late.
Alternatives considered
Setting properties from the host entry somewhere where the to-be-created session can find them. But where? Such properties cannot be set on the session itself since it doesn't exist yet. Setting them on the client won't work because the settings are specific to the new session, but a client can created many sessions. We'd risk using the wrong settings for the wrong sessions.
This extra "connection context"
AttributeRepository
appears to be the right place, provided theSshClient
can make sure it gives each session its own such attribute repository (which is possible).Additional context
JGit has implemented that years ago in their SSH transport.
The text was updated successfully, but these errors were encountered: