skip to content

An auditor asks that an OpenSSH 10.5 server drop every non-post-quantum key exchange and every SHA-1 algorithm; which sshd_config lines achieve that, and what can break?

level: seniorimportance: should knowfreq 16%

answer

  1. read the defaults before editing
  2. a minus prefix removes from defaults
  3. SHA-1 hides in the MAC list
  4. AEAD ciphers ignore the MAC
  5. not settable inside Match

basics

~20 s

Set KexAlgorithms -curve25519-sha256*,ecdh-sha2-* and MACs -hmac-sha1*, leaving mlkem768x25519-sha256, the sntrup761 hybrids and the SHA-2 and UMAC MACs. The default ciphers and host-key algorithms already exclude SHA-1. Clients offering no post-quantum hybrid then fail key exchange.

solid answer

~40 s

Start from the 10.5 defaults, not memory. sshd's default `KexAlgorithms` is `mlkem768x25519-sha256`, the two `sntrup761x25519-sha512` names, `curve25519-sha256` under two names and three `ecdh-sha2-nistp*` methods; finite-field Diffie-Hellman left sshd's default list in 10.0. So `KexAlgorithms -curve25519-sha256*,ecdh-sha2-*` leaves only the post-quantum hybrids. The default `MACs` still include `[email protected]` and `hmac-sha1`, so add `MACs -hmac-sha1*`. The default `Ciphers` contain nothing SHA-1, and SHA-1 `ssh-rsa` signatures have been off by default since 8.8, unless an old `+ssh-rsa` line put them back. What breaks: a client offering neither hybrid fails key exchange (OpenSSH clients only offer one by default since 8.9), and because these keywords are not allowed in `Match`, you cannot exempt a single address.

code

ini · 5 lines
ini
# sshd_config: post-quantum key exchange only, no SHA-1 MACs
KexAlgorithms -curve25519-sha256*,ecdh-sha2-*
MACs -hmac-sha1*
# Ciphers and HostKeyAlgorithms left at their 10.5 defaults:
# neither contains a SHA-1 algorithm

go deeper

for a junior

Recall that KexAlgorithms, Ciphers and MACs in sshd_config control what the server permits, and that defaults must be read from the current man page, not old guides.

for a middle

Explain the minus, plus and caret prefixes versus a full replacement, which 10.5 default entries are classical or SHA-1, and why AEAD ciphers make the MAC list matter only for CTR.

for a senior

Plan the change: inventory clients lacking a post-quantum hybrid, hunt old +ssh-rsa overrides, and know these keywords cannot be relaxed per Match block.

for a principal

Weigh compliance against reach: requiring hybrid key exchange protects recorded traffic but strands old clients; choose between upgrades, a documented exception or an isolated legacy endpoint.

## Start from what 10.5 actually offers Hardening guides copied from older releases list algorithms that OpenSSH 10.5 no longer offers by default, and miss the ones it still does. Read sshd_config(5) or `myproposal.h` for the release you run. In 10.5, sshd's defaults are: | Keyword | Default entries | Relevant to the finding | |---|---|---| | `KexAlgorithms` | `mlkem768x25519-sha256`; `sntrup761x25519-sha512` and `[email protected]`; `curve25519-sha256` and `[email protected]`; `ecdh-sha2-nistp256`, `-nistp384`, `-nistp521` | the curve25519 and ECDH entries are classical, not post-quantum | | `Ciphers` | `[email protected]`; `[email protected]`, `[email protected]`; `aes128-ctr`, `aes192-ctr`, `aes256-ctr` | nothing SHA-1, no CBC | | `MACs` | UMAC and HMAC-SHA2 variants, plus `[email protected]` and `hmac-sha1` | the two SHA-1 MACs | | `HostKeyAlgorithms`, `PubkeyAcceptedAlgorithms` | Ed25519, ECDSA, FIDO and `rsa-sha2-512` / `rsa-sha2-256`, with certificate forms, among others | no SHA-1 `ssh-rsa` since 8.8 | Two release facts shape that table: 10.0 removed the `diffie-hellman-group*` and `diffie-hellman-group-exchange-*` methods from sshd's default list (the client still offers them), and 10.0 made `mlkem768x25519-sha256` the preferred default. Why the hybrids matter, and how the two sides settle on one method, belongs to the material on key exchange; here the question is which lines to write. ## Remove, or replace Every algorithm keyword accepts four forms: - a plain list **replaces** the defaults; - a leading `+` **appends** to them; - a leading `-` **removes** the listed entries, wildcards included; - a leading `^` **moves** the listed entries to the head. ```ini # Form 1: subtract from the defaults KexAlgorithms -curve25519-sha256*,ecdh-sha2-* MACs -hmac-sha1* # Form 2: state the full list explicitly # KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,[email protected] ``` The trade-off between them: - **Subtracting** keeps whatever a future release adds to the defaults, which is usually what you want, but an auditor has to know the defaults to read it. - **Replacing** freezes the list: the auditor reads it at a glance, but nothing new arrives on upgrade until someone edits the file. For key exchange, the server's ordering is not what decides; sshd_config(5) says the client specifies the preference order. The server list controls what is **permitted**, which is exactly what the finding asks for. ## Why the MAC change is mostly symbolic `[email protected]` and the AES-GCM ciphers authenticate every packet themselves. When one of them is negotiated, the offered MACs are ignored (the chacha20-poly1305 draft says so explicitly, and RFC 5647 notes that AES-GCM's encryption key provides integrity too, so a separate integrity key goes unused). The MAC list therefore only matters when an AES-CTR cipher is chosen. Removing `hmac-sha1*` satisfies the finding and costs modern clients nothing, because the remaining SHA-2 and UMAC entries, in both encrypt-then-MAC and classic forms, still serve a client that negotiates a CTR cipher, provided it supports any one of them. ## What can break 1. **Clients without a post-quantum hybrid.** OpenSSH clients added `[email protected]` to their default list in 8.9, made it the preferred default in 9.0, and added `mlkem768x25519-sha256` in 9.9. Older clients, and SSH stacks in appliances or libraries that never implemented either, fail key exchange before authentication starts. 2. **No per-address exception.** `KexAlgorithms`, `Ciphers`, `MACs` and `HostKeyAlgorithms` are not among the keywords allowed inside a `Match` block, so one sshd cannot relax them for a single legacy address. The choices are upgrading that client, a documented exception, or a separate sshd instance with its own configuration reachable only from it. 3. **Old overrides.** A `HostKeyAlgorithms +ssh-rsa` or `PubkeyAcceptedAlgorithms +ssh-rsa` line added years ago for a legacy client quietly reintroduces SHA-1 signatures. Search the whole configuration, includes too. ## Rolling it out 1. Inventory the clients that connect, including automation, monitoring and network equipment, and find out which key exchange methods each offers. 2. Search the whole configuration, includes and `Match` blocks too, for algorithm keywords set long ago. 3. Change one keyword at a time, keeping an existing session open while you reload, so a client that fails can be traced to one change. 4. Record the resulting effective lists for the auditor, because a subtracted list only makes sense alongside the release's defaults. 5. Revisit the lines after every OpenSSH upgrade, since the defaults they subtract from move between releases. After the change, OpenSSH 10.1 and later clients stop showing their warning about non-post-quantum key exchange for this server, which is a quick way to confirm the result from the client side.

  • Does removing hmac-sha1 break a client that negotiates [email protected]?
    No. chacha20-poly1305 and AES-GCM authenticate each packet themselves, so when one is chosen the offered MACs are ignored. The MAC list only decides integrity protection when an AES-CTR cipher is negotiated, which is why trimming it rarely breaks a modern client.
  • Why not just put the post-quantum method first in sshd's KexAlgorithms so clients pick it?
    For key exchange the server's order is not what decides: sshd_config(5) says the client specifies the preference order. The server list only controls which methods are permitted, so removing the classical ones is how you require a hybrid.
  • One legacy appliance must keep connecting with curve25519-sha256. What are the options?
    The algorithm keywords cannot be set inside a `Match` block, so one sshd offers no per-address exception. Upgrade or replace the appliance's SSH stack, record a documented exception, or run a separate sshd instance with its own configuration on another address or port, reachable only from that appliance.

  • The order of sshd's KexAlgorithms list decides which method a client uses.
  • OpenSSH 10.5's sshd still offers SHA-1 ssh-rsa host-key signatures by default.
  • Removing hmac-sha1 breaks clients that negotiate chacha20-poly1305.
  • A leading + in KexAlgorithms removes the listed methods from the defaults.
  • sshd's default KexAlgorithms still includes diffie-hellman-group14-sha256.
  • A Match Address block can relax KexAlgorithms for one legacy client.

Assumes OpenSSH 10.5 defaults: sshd dropped finite-field DH from KexAlgorithms and made mlkem768x25519-sha256 the default in 10.0; SHA-1 ssh-rsa signatures have been off by default since 8.8.