hierynomus / hierynomus/sshj

Native Image of an application with SSHJ fails to reach a settlement upon SSH handshake

Open
#858 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

While trying to build a GraalVM native image of a project with SSHJ as dependency, and running it to create an SSH connection with whatever equipment, the SSH handshake fails because there is no algorithm to choose, due to missing BouncyCastle support. I've tried implementing #828 locally to see if it could fix, but the problem still continued (and seemed unrelated).

Note.: The image and log below are missing two SSHJ log messages (that indicate that BouncyCastle is not registered and could not be registered) because of the #828 local implementation. With or without the patch applied, the error remains the same.

![2023-04-28_11-26](https://user-images.githubusercontent.com/5214283/235212017-1215fb33-eac0-4f85-8f9f-df6056403d52.png)

```java
2023-04-28 17:05:26 [http-nio-7300-exec-3] ERROR net.schmizz.sshj.DefaultConfig - Could not read the sshj.properties file, returning an 'unknown' version as fallback.
2023-04-28 17:05:26 [http-nio-7300-exec-3] INFO n.s.sshj.transport.random.JCERandom - Creating new SecureRandom.
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting CHACHA
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting CAST5/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting CAST5/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting IDEA/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting IDEA/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Serpent/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CTR/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Cannot find any provider supporting Twofish/CBC/NoPadding
2023-04-28 17:05:26 [http-nio-7300-exec-3] WARN net.schmizz.sshj.DefaultConfig - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
2023-04-28 17:05:26 [http-nio-7300-exec-3] DEBUG c.f.provisioning.ssh.SshExecutor - Connecting...(timeout: 30000 ms)
2023-04-28 17:05:26 [pool-9-thread-1] INFO n.s.sshj.transport.TransportImpl - Client identity string: SSH-2.0-SSHJ_VERSION_UNKNOWN
2023-04-28 17:05:26 [pool-9-thread-1] INFO n.s.sshj.transport.TransportImpl - Server identity string: SSH-2.0-OpenSSH_8.2
2023-04-28 17:05:26 [sshj-Reader-/10.0.3.43:22-1682701526349] ERROR n.s.sshj.transport.TransportImpl - Dying because - Unable to reach a settlement of KeyExchangeAlgorithms: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
net.schmizz.sshj.transport.TransportException: Unable to reach a settlement of KeyExchangeAlgorithms: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
at net.schmizz.sshj.transport.Proposal.firstMatch(Proposal.java:175)
at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:129)
at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:233)
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:380)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:495)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:200)
at net.schmizz.sshj.transport.Reader.run(Reader.java:60)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
2023-04-28 17:05:26 [sshj-Reader-/10.0.3.43:22-1682701526349] INFO n.s.sshj.transport.TransportImpl - Disconnected - UNKNOWN
2023-04-28 17:05:26 [pool-9-thread-1] ERROR net.schmizz.concurrent.Promise - <> woke to: net.schmizz.sshj.transport.TransportException: Unable to reach a settlement of KeyExchangeAlgorithms: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
2023-04-28 17:05:26 [http-nio-7300-exec-3] DEBUG c.f.p.d.s.controller.OltOperations - Failed to get OLT info (10.0.3.43)
2023-04-28 17:05:26 [http-nio-7300-exec-3] ERROR c.f.p.c.a.PlanRepositoryServiceControllerAdvice - Exception: TransportException (Unable to reach a settlement of KeyExchangeAlgorithms: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256])
net.schmizz.sshj.transport.TransportException: Unable to reach a settlement of KeyExchangeAlgorithms: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256]
at net.schmizz.sshj.transport.Proposal.firstMatch(Proposal.java:175)
at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:129)
at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:233)
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:380)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:495)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:200)
at net.schmizz.sshj.transport.Reader.run(Reader.java:60)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
```

Anyone have an idea of what is happening, and how fix it?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.