Yuefeng created SSHD-1353:
-----------------------------
Summary: SSH_MSG_KEXINIT sent first with
SEND_IMMEDIATE_KEXINIT=false
Key: SSHD-1353
URL: https://issues.apache.org/jira/browse/SSHD-1353
Project: MINA SSHD
Issue Type: Bug
Affects Versions: 2.16.0
Reporter: Yuefeng
My sshClient is initialized with SEND_IMMEDIATE_KEXINIT = false
{code:java}
SshClient sshClient = SshClient.setUpDefaultClient();
PropertyResolverUtils.updateProperty(sshClient,
CoreModuleProperties.SEND_IMMEDIATE_KEXINIT.getName(), false); {code}
I observed the following exchanges with a sshd server
{code:java}
sessionCreated(ClientSessionImpl[null@/X:22]) tracking
initializeProxyConnector(ClientSessionImpl[null@/X:22]) no proxy to initialize
sendIdentification(ClientSessionImpl[null@/X:22]): SSH-2.0-APACHE-SSHD-2.16.0
writeBuffer(Nio2Session[local=/X:40880, remote=/X:22]) writing 28 bytes
setupDefaultSessionIdentities(ClientSessionImpl[X@/X:22]) key identity provider
override in session listener
Connected to /X:22 after 9723582 nanos
addPasswordIdentity(ClientSessionImpl[X@/X:22]) SHA256:----
doReadIdentification(ClientSessionImpl[X@/X:22]) line='SSH-2.0-OpenSSH_8.2'
readIdentification(ClientSessionImpl[X@/X:22]) Server version string:
SSH-2.0-OpenSSH_8.2
sendKexInit(ClientSessionImpl[X@/X:22]) Send SSH_MSG_KEXINIT{code}
'SSH_MSG_KEXINIT' is sent from mina ssh before peer has sent 'SSH_MSG_KEXINIT'.
This peer happens to be sensitive about the order of 'SSH_MSG_KEXINIT', so
negotiation stalls.
In AbstractClientSession.class, it looks like unless a KexExtensionHandler for
PREKEX is set, KEXINIT is sent regardless of 'sendImmediateKexInit=false'
{code:java}
protected void initializeKeyExchangePhase() throws Exception {
KexExtensionHandler extHandler = getKexExtensionHandler();
if ((extHandler == null) || (!extHandler.isKexExtensionsAvailable(this,
AvailabilityPhase.PREKEX))) {
kexState.set(KexState.INIT);
sendKexInit();
...
}
protected boolean readIdentification(Buffer buffer) throws Exception {
...
} else if (!sendImmediateKexInit) {
// if client identification sent, perhaps we delayed KEX-INIT
initializeKeyExchangePhase();
}
}{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]