Skip to content

Proxy SSH certificates via ssh-agent-lib 0.6 PublicCredential (fix #56) - #95

Draft
sini wants to merge 1 commit into
overhacked:mainfrom
sini:fix/certs-ssh-agent-lib-0.6
Draft

Proxy SSH certificates via ssh-agent-lib 0.6 PublicCredential (fix #56)#95
sini wants to merge 1 commit into
overhacked:mainfrom
sini:fix/certs-ssh-agent-lib-0.6

Conversation

@sini

@sini sini commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #56: an SSH certificate in any upstream agent made the mux unusable — ssh-add -l returned incomplete message, and with #94 merged it instead silently dropped every other agent's keys.

ssh-agent-lib 0.5.1 typed identities as ssh_key::public::KeyData, which cannot represent an OpenSSH certificate. request_identities decoded a …-cert-v01@openssh.com blob into a lossy opaque key (only the certificate nonce survived) and re-serialized a truncated identity, so an OpenSSH client parsing it back as a certificate ran out of bytes.

This bumps to ssh-agent-lib 0.6.0, whose PublicCredential (Key(KeyData) | Cert(Box<Certificate>)) round-trips certificates losslessly in both identity listings and sign requests. The known_keys map is now keyed by credential.key_data(), so a certificate, its bare public key, and the sign request OpenSSH issues all resolve to the same upstream agent.

Scope / ssh-key 0.7

ssh-agent-lib 0.6.0 builds on the released ssh-key 0.6.7 — no pre-release or patched dependency. Certificates with a real valid_before (as OpenSSH and correctly configured issuers produce) round-trip fine.

The one remaining gap is certificates minted with valid_before = u64::MAX (Valid: forever): ssh-key 0.6.7 rejects those with SSH key error: invalid time (RustCrypto/SSH#504, fixed in ssh-key 0.7). That is an ssh-key limitation, not the mux — and arguably such certs should not be minted (a certificate that carries an expiring token's authorization should expire with it; see openpubkey/opkssh#606).

Testing

Verified against real certificates:

  • ssh-add -l through the mux lists both the bare key and the …cert-v01@openssh.com certificate (previously incomplete message).
  • ssh-add -T signs through the mux for both the key and the certificate, routing to the upstream that holds it.

The certificate integration test added in #66 exercises this path.

@sini
sini force-pushed the fix/certs-ssh-agent-lib-0.6 branch from 223f6c2 to e861c70 Compare August 14, 2026 02:23
 overhacked#56)

ssh-agent-lib 0.5.1 typed identities as ssh_key::public::KeyData, which cannot
represent an OpenSSH certificate: request_identities decoded a
...-cert-v01@openssh.com blob into a lossy opaque key and re-serialized a
truncated identity, so any upstream agent holding a certificate made
`ssh-add -l` fail with "incomplete message" and (with overhacked#94) silently dropped
every other agent's keys.

Bump to ssh-agent-lib 0.6.0, whose PublicCredential (Key | Cert) round-trips
certificates losslessly in both identity listings and sign requests. Key the
known-keys map by credential.key_data() so a certificate, its bare public key,
and the sign request ssh issues all resolve to the same upstream agent.

Note: certificates with valid_before = u64::MAX ("Valid: forever") still fail
to decode under the ssh-key 0.6.7 that ssh-agent-lib 0.6.0 builds on
(RustCrypto/SSH#504, fixed in ssh-key 0.7). Certificates with a real
expiration -- as OpenSSH and correctly configured issuers produce -- work now.
@sini
sini force-pushed the fix/certs-ssh-agent-lib-0.6 branch from e861c70 to 8c47a16 Compare August 14, 2026 02:37
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

Successfully merging this pull request may close these issues.

Agent is unusable if any of the upstream agents responds with SSH certificates

1 participant