5 Commits
Author SHA1 Message Date
Lucas Chollet 5f37b60744 SSHServer+LibSSH: Read the host keys from /etc/ssh/
This will allow SSHServer to have a stable private key without using
--unsafe-stub-private-key. We already had support for reading public
keys and this commit adds support for openssh's proprietary private key
file format. It is unfortunately not standardized, and while I
considered using a custom file format I think that being compatible with
`ssh-keygen` is better for the moment.
2026-08-22 21:49:12 +02:00
Lucas Chollet af73641ffb LibSSH: Support encoding numbers with leading zeroes as mpint
As I failed to write a VERIFY that would hit this case, when the shared
secret started with two null bytes, we were silently creating an invalid
mpint which would make the ssh client abort the connection with this
message:
ssh_dispatch_run_fatal: Connection to [Server IP]: incorrect signature

AFAICT, this patch makes the error go away.
2026-05-20 15:42:47 +02:00
Lucas Chollet c8e5a4581c LibSSH: Make TypedBlob constructible from raw bytes or a string
This will later be used for reading public keys from the network or from
a local file.
2026-04-08 13:43:19 +02:00
Lucas Chollet bed715c323 LibSSH+SSHServer: Add support for decrypting packets using ChaCha20
This means that we can now decrypt the SERVICE_REQUEST message, and we
log:

Client protocol string: SSH-2.0-OpenSSH_10.0p2 Ubuntu-5ubuntu5.1
KEXINIT message sent
KEX_ECDH_REPLY message sent
NEWKEYS message received, we should use encryption from now on
Service 'ssh-userauth' requested
error: Draw the rest of the owl
2026-03-23 12:43:36 +01:00
Lucas Chollet eaee493008 LibSSH+SSHServer: Perform a key exchange on connection
This is once again very limited. We only support one `curve25519-sha256`
for the key exchange and `ssh-ed25519` as the host key.

With the SSH_DEBUG macro set and connecting from my host, it now prints:
```
Client protocol string: SSH-2.0-OpenSSH_10.0p2 Ubuntu-5ubuntu5
KEXINIT message sent
KEX_ECDH_REPLY message sent
error: Draw the rest of the owl
```
The client seems happy with the key exchange, and the following message
is encrypted!
2026-03-17 13:33:25 +01:00