Why can't an OpenSSH 10.5 client reach an old switch offering only diffie-hellman-group14-sha1 and ssh-rsa, and what is the narrowest fix?
answer
- implemented is not the same as offered
- two categories fail in turn
- RSA key type versus SHA-1 signature
- append for one host only
basics
~20 sNeither algorithm is in the 10.5 client's defaults: diffie-hellman-group14-sha1 left the default key exchange list in OpenSSH 8.2, and SHA-1 ssh-rsa signatures were disabled by default in 8.8. Append both with '+' for that one host.
solid answer
~40 sNegotiation fails because the switch's offers and the client's defaults share nothing. OpenSSH dropped `diffie-hellman-group14-sha1` from its default key exchange proposal in 8.2 and stopped accepting SHA-1 `ssh-rsa` host-key signatures by default in 8.8, so the client reports `no matching key exchange method found` and, with that fixed, `no matching host key type found`. Both algorithms are still implemented, just not offered. The narrowest fix is a host-specific stanza in the jump host's client configuration: `KexAlgorithms +diffie-hellman-group14-sha1` and `HostKeyAlgorithms +ssh-rsa`. The `+` appends to the defaults, so every other destination is untouched and the switch picks up stronger algorithms on its own once its firmware offers them. Since 10.1 the client also warns that the session is not post-quantum; silence that for this host only (`WarnWeakCrypto no-pq-kex`) and track the switch as a stopgap.
code
ini · 4 linesHost core-sw1.internal.example
KexAlgorithms +diffie-hellman-group14-sha1
HostKeyAlgorithms +ssh-rsa
WarnWeakCrypto no-pq-kexgo deeper
Recall that SSH errors saying 'no matching ... found' mean the two sides share no algorithm, and that old devices often need an old algorithm turned back on.
Explain why each category fails, separate the RSA key type from SHA-1 ssh-rsa signatures, and write the per-host stanza that appends rather than replaces.
Scope the exception to one destination, record it as accepted risk with a warning exemption, and push for firmware that signs with rsa-sha2 and offers modern key exchange.
Decide how long legacy devices may keep weak algorithms, who owns the exception list, and how the estate retires it without breaking network management.
## Why the connection fails SSH negotiation (RFC 4253 section 7.1) succeeds only if, in every category, the client finds an algorithm on its own list that the server also offers. An OpenSSH 10.5 client's default key exchange list is, in order: `mlkem768x25519-sha256`, the `sntrup761x25519-sha512` names, `curve25519-sha256`, the `ecdh-sha2-nistp*` methods, then `diffie-hellman-group-exchange-sha256`, `diffie-hellman-group16-sha512`, `diffie-hellman-group18-sha512` and `diffie-hellman-group14-sha256`. The SHA-1 variant `diffie-hellman-group14-sha1` is not there: OpenSSH removed it from the default proposal of both client and server in **8.2**. The host-key category fails for a related reason. In **8.8** OpenSSH disabled RSA signatures that use SHA-1, the algorithm named `ssh-rsa`, because chosen-prefix collisions on SHA-1 had become affordable. The client's default host-key list still contains RSA, but only as `rsa-sha2-512` and `rsa-sha2-256` (RFC 8332). The error names the category that found no match, in the style OpenSSH documents for legacy peers: 1. `Unable to negotiate with ...: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1` 2. once key exchange is fixed: `no matching host key type found. Their offer: ssh-rsa` ## Key type versus signature algorithm This is the distinction confident answers miss: | Name | What it is | Status in OpenSSH 10.5 | |---|---|---| | `ssh-rsa` as a **key type** | the RSA public key format | still supported | | `ssh-rsa` as a **signature algorithm** | RSA with SHA-1 | supported, off by default since 8.8 | | `rsa-sha2-256` / `rsa-sha2-512` | RSA with SHA-2, same key format | on by default | | `ssh-ed25519` | Ed25519 key and signature (RFC 8709) | on by default | So the switch's RSA host key is not the problem. Its SSH server simply cannot *sign* with anything but SHA-1. If its firmware learns `rsa-sha2-256`, the same key works with no client change. ## The narrowest fix Re-enable the two legacy algorithms for this destination only, by appending to the defaults: ```ini # client configuration on the jump host: one legacy device only Host core-sw1.internal.example KexAlgorithms +diffie-hellman-group14-sha1 HostKeyAlgorithms +ssh-rsa # accepted risk, recorded: no post-quantum key exchange on this device WarnWeakCrypto no-pq-kex ``` Why each choice matters: - **`+` appends** rather than replacing, so modern algorithms stay first and are chosen automatically once the switch supports them. (`-` would remove, `^` would move entries to the head.) - **A `Host` block for that name** keeps every other destination on the defaults; putting these lines in a catch-all block would weaken every connection that happens to meet an old server. How client configuration blocks are matched and ordered is covered with the client configuration file. - If the jump host also logs in to the switch with an RSA user key, the SHA-1 user-signature counterpart is a separate authentication setting. ## The post-quantum warning From **10.1** the client warns whenever a connection negotiates a key exchange that is not post-quantum, citing "store now, decrypt later". `diffie-hellman-group14-sha1` will always trigger it. The `WarnWeakCrypto` option controls the warning: `no-pq-kex` silences just that warning, `no` silences all of them. Doing it per host, as above, keeps the warning meaningful everywhere else and documents an accepted risk. ## The reverse direction The same mismatch can happen the other way round. In **10.0** OpenSSH's sshd removed every finite-field `diffie-hellman-group*` and `diffie-hellman-group-exchange-*` method from its default key exchange list, while the client kept its finite-field methods. A management tool or old device acting as a *client* that offers only finite-field Diffie-Hellman will therefore fail against a freshly upgraded sshd, and the better fix is upgrading that client rather than widening the server. ## Seeing both sides of the mismatch The error line already quotes the server's offer (`Their offer: ...`). For the client side, `ssh -Q kex` lists every key exchange method the local build implements, which includes `diffie-hellman-group14-sha1`, while `ssh -G core-sw1.internal.example` prints the configuration that would actually be used for that destination, including the effective `KexAlgorithms` and `HostKeyAlgorithms` lists. Comparing the two shows whether an algorithm is missing from the build or merely absent from the defaults, which is the whole diagnosis here. ## Treat it as a stopgap - Record which devices need legacy stanzas and why. - Prefer firmware that offers `rsa-sha2-*` and an elliptic-curve or hybrid exchange. - Never fix this with `StrictHostKeyChecking no`: host-key checking is not what failed, and turning it off only removes the protection that still works.
- Why append with `+` instead of writing a complete KexAlgorithms list for the switch?A complete list freezes today's choice: the switch would keep using SHA-1 Diffie-Hellman even after a firmware update adds better methods. Appending keeps OpenSSH's defaults in front, so the client's first common algorithm moves up automatically, and the legacy entry is used only while nothing better is offered.
- An old monitoring client offering only finite-field Diffie-Hellman fails against a newly upgraded OpenSSH 10.x server. Why?sshd 10.0 removed the `diffie-hellman-group*` and `diffie-hellman-group-exchange-*` methods from its default key exchange list, while OpenSSH's own client kept offering them. A client that knows nothing else now has no common method. Upgrading that client is the better fix than re-enabling finite-field methods on the server.
- Does the switch need a new host key before it can be reached without the ssh-rsa exception?Not necessarily. The RSA key format is fine; only SHA-1 signatures are disabled. If the switch's SSH server learns to sign with `rsa-sha2-256` or `rsa-sha2-512`, the existing key works with OpenSSH's defaults and the known_hosts entry stays valid.
- Set KexAlgorithms to diffie-hellman-group14-sha1 for all hosts so everything connects.
- OpenSSH 10.5 no longer contains group14-sha1 at all, so downgrade the client.
- The switch's RSA host key must be replaced because RSA keys are disabled.
- Setting StrictHostKeyChecking no fixes 'no matching host key type found'.
- The post-quantum warning means the connection to the switch failed.
Assumes OpenSSH 10.5; group14-sha1 left the defaults in 8.2, SHA-1 ssh-rsa signatures in 8.8, the post-quantum warning arrived in 10.1, and sshd dropped finite-field DH in 10.0.