shikhar/sshj — Issue #49: Protocol Error - Channel Failure on ExtremeXOS based devices.
Author: eliasjsalves
Created: 2011-12-27 19:20:09+00:00
State: open

Version 0.6.1

Trying to execute a command in: BlackDiamond8810, Summit48I and SummitX480 (Extreme Networks) and all of them cause this error on log.

14 [main] INFO net.schmizz.sshj.common.SecurityUtils - BouncyCastle not registered, using the default JCE provider
516 [main] WARN net.schmizz.sshj.DefaultConfig - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
608 [main] INFO net.schmizz.sshj.transport.TransportImpl - Client identity string: SSH-2.0-SSHJ_0_6_0
635 [main] INFO net.schmizz.sshj.transport.TransportImpl - Server identity string: SSH-2.0-4.1.2 SSH Secure Shell Toolkit
635 [main] INFO net.schmizz.sshj.transport.KeyExchanger - Sending SSH_MSG_KEXINIT
656 [reader] INFO net.schmizz.sshj.transport.KeyExchanger - Received SSH_MSG_KEXINIT
708 [reader] INFO net.schmizz.sshj.transport.kex.DHG1 - Sending SSH_MSG_KEXDH_INIT
842 [reader] INFO net.schmizz.sshj.transport.KeyExchanger - Received kex followup data
844 [reader] INFO net.schmizz.sshj.transport.kex.DHG1 - Received SSH_MSG_KEXDH_REPLY
875 [reader] INFO net.schmizz.sshj.transport.KeyExchanger - Sending SSH_MSG_NEWKEYS
875 [reader] INFO net.schmizz.sshj.transport.KeyExchanger - Received SSH_MSG_NEWKEYS
881 [main] INFO net.schmizz.sshj.SSHClient - Key exchange took 0.246 seconds
910 [main] INFO net.schmizz.sshj.transport.TransportImpl - Setting active service to ssh-userauth
911 [main] INFO net.schmizz.sshj.userauth.UserAuthImpl - Trying `password` auth...
911 [main] INFO net.schmizz.sshj.userauth.method.AuthPassword - Requesting password for [AccountResource] user@192.168.10.5
1059 [main] INFO net.schmizz.sshj.userauth.UserAuthImpl - `password` auth successful
1059 [main] INFO net.schmizz.sshj.transport.TransportImpl - Setting active service to ssh-connection
1067 [main] INFO net.schmizz.sshj.connection.ConnectionImpl - Attaching `session` channel (#0)
1087 [reader] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Initialized - < session channel: id=0, recipient=0, localWin=[winSize=2097152], remoteWin=[winSize=16384] >
1088 [main] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Will request to exec `show lacp counters`
1088 [main] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Sending channel request for `exec`
1107 [reader] INFO net.schmizz.sshj.transport.TransportImpl - Received SSH_MSG_IGNORE
1107 [reader] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Got EOF
1108 [reader] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Got close
1108 [reader] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Sending EOF
1108 [reader] INFO net.schmizz.sshj.connection.channel.direct.SessionChannel - Sending close
1108 [reader] INFO net.schmizz.sshj.connection.ConnectionImpl - Forgetting `session` channel (#0)
1125 [reader] ERROR net.schmizz.sshj.transport.TransportImpl - Dying because - net.schmizz.sshj.connection.ConnectionException: [PROTOCOL_ERROR] Received CHANNEL_FAILURE on unknown channel #0
1126 [reader] INFO net.schmizz.sshj.transport.TransportImpl - Setting active service to null-service

the code:

final SSHClient ssh = new SSHClient();
ssh.addHostKeyVerifier(new PromiscuousVerifier());
ssh.connect("192.168.10.5");
try {
ssh.authPassword("user", "pass");
final Session session = ssh.startSession();
try {
final Command cmd = session.exec("show lacp counters");
cmd.join(5, TimeUnit.SECONDS);
System.out.println(IOUtils.readFully(cmd.getInputStream()).toString());
System.out.println("\nEXIT STATUS: " + cmd.getExitStatus());
} finally {
session.close();
}
} finally {
ssh.disconnect();
}

In another devices, like Cisco or Juniper, this code works properly.