lawmin2021 opened a new issue, #609:
URL: https://github.com/apache/mina-sshd/issues/609
### Version
2.13.2
### Bug description
the mina sshd 2.13.2 has problem to parse follow code:
private ClientSession getSessionUsingJumpHost(
SshClient sshClient, CommandObject commandObject)
throws OcmdException, IOException
{
String hostName = commandObject.getNode();
String user = commandObject.getUser();
int port = Constants.getSSHPort();
// configure the bastion entry
HostConfigEntry bastion = new HostConfigEntry();
bastion.setHost(Constants.getTunnelHost());
bastion.setHostName(Constants.getTunnelHost());
bastion.setUsername(Constants.getTunnelHostUser());
bastion.setPort(port);
bastion.setIdentities(
Collections.singleton(Constants.getTunnelHostUserKey()));
// configure the generate target entry
HostConfigEntry targetHost = new HostConfigEntry();
targetHost.setHost("*"); // for all include hostname/ip
targetHost.setProxyJump(Constants.getTunnelHost());
HostConfigEntryResolver resolver =
HostConfigEntry.toHostConfigEntryResolver(
GenericUtils.asList(bastion, targetHost));
sshClient.setHostConfigEntryResolver(resolver);
// enable the public auth
sshClient.setUserAuthFactories( Collections.unmodifiableList(
Arrays.asList(
UserAuthPublicKeyFactory.INSTANCE,
UserAuthPasswordFactory.INSTANCE,
UserAuthKeyboardInteractiveFactory.INSTANCE
)));
// now try to connect using proxy
try
{
ClientSession session = sshClient.connect(user, hostName, port)
.verify(sessionConnectTimeout)
.getSession();
return session;
}
catch (Exception ex)
{
throw ex;
}
}
above code work in mina sshd 2.12.1.
### Actual behavior
The Mina SSHD code in SshClient.parseProxyJumps(HostConfigEntry entry,
AttributeRepository context) method has an issue with identifying the variable
"additionalHops" , and it causes the list object "hops" continuously grow to
the maximum limit of 10, and then throw the IlllegalArgumentException.


please check the attached debug images
### Expected behavior
I think in SshClient.parseProxyJumps() need to check if the return values of
"additionalHops" is already in the "hops", it need to stop and return without
throw exception
### Relevant log output
_No response_
### Other information
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]