Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to connect to higher version OpenSSL server after configuring KeepAliveInterval #933

Open
2211898719 opened this issue Mar 6, 2024 · 3 comments

Comments

@2211898719
Copy link

ssh.getConnection().getKeepAlive().setKeepAliveInterval(60);

image

net.schmizz.sshj.transport.TransportException: strict KEX violation: unexpected packet type 2 (seqnr 1) at net.schmizz.sshj.transport.TransportImpl.gotDisconnect(TransportImpl.java:548) ~[sshj-0.38.0.jar:na] at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:500) ~[sshj-0.38.0.jar:na] at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113) ~[sshj-0.38.0.jar:na] at net.schmizz.sshj.transport.Decoder.received(Decoder.java:200) ~[sshj-0.38.0.jar:na] at net.schmizz.sshj.transport.Reader.run(Reader.java:60) ~[sshj-0.38.0.jar:na]

<dependency> <groupId>com.hierynomus</groupId> <artifactId>sshj</artifactId> <version>0.38.0</version> </dependency>

@2211898719
Copy link
Author

image

@derklaro
Copy link

derklaro commented Mar 6, 2024

I had the same issue. Fixed by using a custom KeepAlive sender that just waits until the key exchange is completed before starting the hearbeat. This seems to be fixed with the KEEP_ALIVE keepalive strategy, but not when using HEARTBEAT:

// Ensure the service is set... This means that the key exchange is done and the connection is up.
if (conn.equals(conn.getTransport().getService())) {
emptyQueue(queue);
checkMaxReached(queue);
queue.add(conn.sendGlobalRequest("[email protected]", true, new byte[0]));
}
}

@2211898719
Copy link
Author

How to customize it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants