Hi There,I was working on setting up mina sshd server in node A and was trying to run remote port-forward ssh command from node B to open one port on node A for forwarding all calls to node B (which would be eventually forwarded to a server running on node B). Now as you must have known, mina-sshd in turn uses sshd-core as one of its dependencies. This setup worked fine for me with sshd-core versions <=2.5.1, but when I tried with sshd-core versions 2.6.0 and 2.7.0, the forwarding part is not working as expected. Currently, I am using sshd-core version 2.0.0, which is fine, but now I want to switch to 2.7.0 and when I am upgrading the version, it is not working as expected.I am starting mina-sshd server on node A and then running below remote port-forwarding command on node B which will establish reverse ssh tunnel between node B to node A and one port will be allocated on node A where it will be listening. Any requests coming to that port will be forwarded to node B.Client-side command (node B):
ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -o UserKnownHostsFile=<public-key> -N -T -R 0.0.0.0:0:localhost:8080 -i private-key -p 8990 username@nodeA-ip -vvv Using this command, I am getting port allocated on node A and the authentication part is going fine, but when I try to make any calls (forwarding part) to that port (on node A), I am getting the below error message in the client console (on node B). Here 10559 is allocated port on node A for forwarding. debug3: receive packet: type 90 debug1: client_input_channel_open: ctype forwarded-tcpip rchan 1 win 2097152 max 32768 debug1: client_request_forwarded_tcpip: listen 0:0:0:0:0:0:0:0 port 10559, originator 0:0:0:0:0:0:0:1 port 63303 WARNING: Server requests forwarding for unknown listen_port 10559 debug1: failure forwarded-tcpip debug3: send packet: type 92 And at the same time, on the server side logs (on node A), I am getting the below exception [2021-08-16 12:21:36.589 +0530] WARN [sshd-SshServer[5496c165](port=8990)-nio2-thread-9] - o.a.s.c.c.ClientChannelPendingMessagesQueue: operationComplete(ClientChannelPendingMessagesQueue[channel=TcpipClientChannel[id=0, recipient=-1]-ServerSessionImpl[username@/nodeB-hostname], open=false]) SshChannelOpenException[open failed] signaled [2021-08-16 12:21:36.591 +0530] WARN [sshd-SshServer[5496c165](port=8990)-nio2-thread-9] - c.c.t.m.f.CountedForwardingFilter: Failed (SshChannelOpenException) to open channel for session=Nio2Session[local=/127.0.0.1:10559, remote=/127.0.0.1:61609]: open failed org.apache.sshd.common.channel.exception.SshChannelOpenException: open failed at org.apache.sshd.client.channel.AbstractClientChannel.handleOpenFailure(AbstractClientChannel.java:388) at org.apache.sshd.common.session.helpers.AbstractConnectionService.channelOpenFailure(AbstractConnectionService.java:569) at org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:459) at org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:503) at org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:429) at org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1466) at org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:389) at org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64) at org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:359) at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:336) at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:333) at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$completed$0(Nio2CompletionHandler.java:38) at java.security.AccessController.doPrivileged(Native Method) at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37) at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) at sun.nio.ch.Invoker$2.run(Invoker.java:218) at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) I am not very familiar with the internals and codebase of mina-sshd and sshd-core, so can you please help me to resolve this? As I mentioned, it is working fine with sshd-core version 2.0.0, 2.5.0, 2.5.1 but when I try with 2.6.0 and 2.7.0, it is showing the above-mentioned errors. Earlier, I was using 'ForwardingFilter' with sshd-core 2.0.0, which I have updated as 'Forwarder' as it is renamed in sshd-core 2.6.0. I am not sure whether that is the culprit or not, but any help would be really appropriated. Thanks & regards, Meetraj.