Skip to content

Latest commit

 

History

History
93 lines (57 loc) · 26.7 KB

openssh-compatibility-status.md

File metadata and controls

93 lines (57 loc) · 26.7 KB

OpenSSH compatibility status and remaining contracts

Full OpenSSH command compatibility is the target, not a claim about the current release. A regression score, accepted option, or working bssh-to-bssh control socket does not establish a complete replacement. Residual work after #314 is tracked in #327 (destination-constrained agent keys); #328 added FIDO security-key support, #331 tracks the built-in internal provider, and #345 tracks WebAuthn security-key host signatures. #281 was closed in favor of #314.

Measurement boundary

The reference is OpenSSH portable V_10_3_P1, immutable commit 2d98db98331803cbb820211b2fb0d31a6e71e58e. The harness executes the candidate bssh binary against the reference server and reruns failures with the reference client. See the harness guide for reproduction commands, verdicts, floors and artifacts. Focused results do not replace the full macOS and Ubuntu matrix.

The compatibility contract concerns single-destination SSH invocation. Parallel/cluster extensions use documented long options; pdsh compatibility is a separate mode and does not redefine ordinary SSH short options. Command behavior, SSH server wire interoperability and local OpenSSH control-socket interoperability are distinct contracts.

Historical workflow run 33457298369 measured macOS 60/66 eligible (six failures, seven environmental, six upstream skips), Ubuntu 61/69 eligible (eight failures, four environmental, six upstream skips). These measurements predate this follow-up and are not fresh integrated-HEAD evidence. The committed tests/openssh-regress/results.json is also historical.

Residual compatibility ledger

This ledger records contracts still requiring implementation or verification, not a claim inferred from fixture coverage. Update behavior and validation evidence together before removing a row.

Area Remaining contract Evidence boundary
Dynamic forwarding Local SOCKS4/4A/5; remote dynamic -R [bind_address:]port, destination restrictions and cancellation Historical dynamic-forward fails on both platforms. Passing its local -D section does not establish remote dynamic support.
Percent/environment Directive-specific tokens and environment expansion, trusted Match exec, explicitly permitted shell LocalCommand Historical percent fails on both platforms. Shell semantics must retain PermitLocalCommand gating and untrusted-input boundaries.
Rekey Actual byte/time-triggered exchange and truthful KEX/NEWKEYS diagnostics rekey passes on Linux (114.3 s candidate, 114.5 s reference) after the client stopped padding every connection by 0.6 s; the manifest minimum is 180 s. macOS remains environmental (the reference client also exceeds the limit there).
Agent Destination-constrained identities (session-bind@openssh.com) bssh sends session-bind@openssh.com on agent and forwarded-agent connections, so destination-constrained keys work for direct authentication. The four multihop phases that sign through a forwarded agent still fail: ssh-agent requires a publickey-hostbound-v00@openssh.com request, which russh 0.65.0 cannot send. Tracked in #327.
Security keys webauthn-sk-* signatures and physical-authenticator validation hostkey-agent, keytype, limit-keytype and agent pass on Linux with the regress sk-dummy middleware. The built-in SecurityKeyProvider internal (the default) signs over USB HID on Linux and macOS (#331) and is covered by mock-transport tests; a check against a physical authenticator is pending user validation. webauthn-sk-ecdsa-sha2-nistp256@openssh.com is not advertised because bssh cannot verify it (#345). bssh-keygen enrolls both SK key types and downloads resident credentials with -K through internal and external providers (#337); mock-device, native ABI, and OpenSSH key-file parsing tests cover these paths.
Multiplexing OpenSSH mux-v4 local protocol, raw -O proxy, complete channel reporting, allocated remote-port replies multiplex passes on Linux (72.1 s) including TCP and Unix-domain -O forward/-O cancel, when the regress directory path fits sockaddr_un. Control sockets still use framed JSON; passenger reuse is not OpenSSH-master interoperability.
Jump hosts CLI/config parsing, SSH URI hops, none, multihop transport/authentication Historical proxyjump fails on both platforms. Parser tests alone do not establish transport behavior.
Remote copy Remote-to-remote copy invocation, transport selection, integrity and exit status Historical Ubuntu scp3 fails; macOS environmental.

Current safety boundaries

Host-aware file preprocessing is the only path that gives trusted Match exec OpenSSH shell semantics. Other parser callers use direct execution: the executable name is fixed before percent-token expansion, percent tokens are expanded only in later arguments, and expanded whitespace stays within its original argument. Command-line hostnames reject whitespace, control bytes and shell metacharacters; remote users entering trusted shell-token paths additionally reject whitespace, $ and backslashes. These restrictions are intentional fail-closed differences until expansion is context-aware.

The Unix ProcessStdin adapter makes read-only FIFOs nonblocking while owned, uses per-call nonblocking reads for sockets so shared write behavior is unchanged, and routes regular files through Tokio's file adapter. A FIFO opened with O_RDWR is explicitly unsupported because changing its shared file-description flags could affect another user of stdin; other non-pipe/socket devices retain the existing blocking adapter and are not claimed cancellation-safe.

The implemented control socket is bssh's private framed-JSON protocol. Its passenger reuse, -O proxy session behavior and status commands do not imply compatibility with OpenSSH mux-v4 masters or raw proxy streams.

Unix-domain forwarding (-L/-R with a socket path on either side, including -O forward/-O cancel) never unlinks an existing path before binding and refuses to serve a bound path that is a symlink or not a socket; the listener socket is owner-only (mode 0600) without any mode change through the path name: on Linux the unbound socket is narrowed before bind(2) so the node is created 0600; elsewhere it is bound in a private mkdtemp directory beside the path, narrowed there with fchmodat(AT_SYMLINK_NOFOLLOW), and moved into place without replacing anything (renamex_np(RENAME_EXCL) on macOS, link(2) then unlink(2) on other BSDs), so the node never appears at the path with a wider mode. Only a socket node is removed on shutdown. StreamLocalBindUnlink and StreamLocalBindMask are still parsed without a runtime consumer; the OpenSSH defaults (no, 0177) are what the implementation applies.

Host certificates are accepted only after full validation: a @cert-authority line (in a known_hosts file or in the KnownHostsCommand output, which receives the certificate as %K/%t and runs once per check) naming the host (or HostKeyAlias) with the signing CA key, host certificate type, a principal matching the host name (principals may be case-sensitive wildcard patterns, as in OpenSSH, and are read only after the CA signature verifies), no critical options, a CA signature algorithm permitted by CASignatureAlgorithms, the validity window, a verified signature, and no revocation by @revoked lines in either source or by any RevokedHostKeys file (plain key lists; a KRL or unreadable file anywhere in the list fails closed). On a non-default port a CA line for the bare host name also matches, as OpenSSH's portless retry does. Without a matching CA the certified key is checked as a plain host key, but only if HostKeyAlgorithms permits its plain type, so a certificate-only list never falls back to known_hosts or first-use recording; a pinned key (ServerCheckMethod::PublicKey/PublicKeyFile) never consults CA lines; with a matching CA any other validation failure refuses the connection instead of downgrading, which is stricter than OpenSSH. HostKeyAlgorithms accepts certificate names and advertises the certificate form of every default algorithm; russh always sends certificate names ahead of plain names, so a mixed list cannot interleave them, and a certificate-only list yields no plain algorithm at all. The host key the server presents must have the type the key exchange negotiated, as kex_verify_host_key requires (SSH_ERR_KEY_TYPE_MISMATCH): rsa-sha2-256 and rsa-sha2-512 select an RSA key, a *-cert-v01@openssh.com name selects a certificate for that key type, and ECDSA curves must match, also for certificates. A mismatch fails the connection with host key type ... does not match the negotiated host key algorithm ... after trust preflight but before recording TOFU keys, publishing verified state, or allowing authentication; russh 0.65.1 verifies the exchange signature with whatever key arrives, so without this check a HostKeyAlgorithms restriction would not limit which trusted key type a server could use. russh does not hand the host key of a re-key to the client, so this check, like the known_hosts check, covers the initial key exchange only. @cert-authority host fields follow OpenSSH matching, including hashed (|1|) entries and !pattern negations that exclude a host from the CA's scope. A RevokedHostKeys path that cannot be expanded refuses every host key instead of disabling revocation, and RevokedHostKeys applies to certificates under StrictHostKeyChecking=no as it does to plain keys.

Security keys

Authenticator-hosted (sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com) keys follow OpenSSH 10.3p1 built with ENABLE_SK_INTERNAL, as distribution builds are. SecurityKeyProvider defaults to internal, the built-in USB HID provider (-G prints securitykeyprovider internal, as the reference does); a $-prefixed value names an environment variable, an unset variable or none disables sk-* identities (logged at debug level, as ssh does), and a path names an external provider. The built-in provider (src/ssh/security_key/internal) is sk-usbhid.c without libfido2: an in-tree CTAPHID, CTAP2 and U2F stack over hidapi (its pure-Rust hidraw backend on Linux, IOKit on macOS, no new runtime library). It follows sk_sign step by step: devices on the FIDO usage page are enumerated (each path once, at most eight, as MAX_FIDO_DEVICES caps them) and opened; without a PIN or verify-required the device holding the credential is found with a silent assertion per device (sk_select_by_cred, skipped for a lone CTAP2 device that reports its uv option), otherwise the device the user touches is chosen (sk_select_by_touch, 15 s, with the dummy makeCredential/REGISTER probe libfido2 uses, polling rounds 200 ms apart, and only success or a PIN error counted as a touch, so a device that refuses the probe drops out instead of winning); getAssertion carries up from the key flags and, for verify-required keys, either the CTAP 2.0 uv option or a pinUvAuthParam from a token obtained through clientPIN (PIN protocol 2 when advertised, else 1; PIN-based permission tokens use subcommand 0x09, while CTAP 2.1 built-in verification uses 0x06 without a PIN hash), and a device without PIN support or built-in verification yields SSH_SK_ERR_PIN_REQUIRED so the PIN prompt follows; devices without CBOR support, or whose getInfo fails (after a timed-out getInfo the channel is allocated again so a late reply cannot answer the first U2F request), fall back to U2F check-only and enforce-presence AUTHENTICATE (ECDSA only), and are never sent CTAPHID_CANCEL, as libfido2 sends it to CTAP2 devices only. One deliberate deviation from libfido2, which waits without limit: a whole built-in signature is bounded at 120 s (sshd's default LoginGraceTime). bssh serializes provider calls process-wide, so a device that streams KEEPALIVE or other channels' frames forever, or a U2F key nobody touches, would otherwise stall authentication to every host; on expiry the pending CTAP2 request is cancelled, the signature fails with timed out waiting for the security key, and authentication continues with the next identity. The resulting flags, counter, and sig_r/sig_s (minimal big-endian, as BN_bn2bin produces) are the same bytes the external provider path hands to sshsk_sign. The CTAPHID framing, CBOR, PIN protocols, U2F encoding, device selection, and the end-to-end signature (verified with ssh-key) are tested against a mock HID transport; CI has no authenticator, so a manual check with a physical key on Linux and macOS is pending user validation. bssh-keygen -t ed25519-sk and bssh-keygen -t ecdsa-sk enroll credentials, and bssh-keygen -K downloads resident keys through either provider. Internal resident enrollment requires PIN-authenticated credential management to avoid replacing an existing application/user credential; protected enrollment requires credProtect. Signed packed/U2F registration attestations are verified without a vendor trust policy; unsigned none attestations remain permitted as in OpenSSH. Serialized handles are limited to 255 bytes by ssh-key, and -O write-attestation=FILE is explicitly unsupported. See bssh-keygen options for supported enrollment options and filename handling. A U2F-only device cannot take a PIN, so a verify-required key on it cannot sign, and Ed25519 keys cannot sign over U2F at all. On Linux the provider reads /dev/hidraw* nodes, which are usually not accessible to an ordinary user until a udev rule grants access (the FIDO udev rules distributed with the libfido2 packages on Debian and Ubuntu serve this purpose); when devices are found but none can be opened, the signature fails with N FIDO device(s) found but none could be opened: <path>: <error>. On macOS devices are opened non-exclusively (hidapi macos-shared-device, as libfido2 does), so a browser can use the key meanwhile. On other platforms (Windows) the built-in provider is not available: a signature fails with built-in security key support is not available on this platform; set SecurityKeyProvider to an sk-api library. An external provider is a shared library implementing sk-api.h version 0x000a0000 (sk_api_version, sk_enroll, sk_sign, sk_load_resident_keys); bssh loads it in process with dlopen(RTLD_NOW | RTLD_LOCAL), as sshsk_open does with RTLD_NOW, so a library with an unresolved symbol is refused at load time; each library is opened once per canonical path and kept for the life of the process instead of being reopened and closed for every identity and connection, and a bare file name refers to a file relative to the working directory (OpenSSH's lib_contains_symbol opens the path directly) rather than one found through the loader search path. bssh calls sk_sign on a blocking thread, printing Confirm user presence for key ... when the key requires a touch and stderr is a terminal, and prompting once for a PIN when the provider reports SSH_SK_ERR_PIN_REQUIRED outside BatchMode. OpenSSH runs the same calls in ssh-sk-helper to keep the middleware out of its pledged client; bssh has no such sandbox, so a helper would add a private protocol without changing what runs as the user. Running in process has accepted costs: an sk_sign call that has started cannot be cancelled, so a hung provider keeps its blocking thread and the process-wide provider lock until it returns and no other security-key signature in the process can proceed meanwhile (connections queued behind it give up at ConnectTimeout without reaching the provider); and the provider can read everything bssh holds in memory, including decrypted keys and passwords for other hosts. A key without an application string is refused before the provider is called, as sshsk_sign refuses it, and an Ed25519 response must carry exactly 64 bytes in sig_r and nothing in sig_s. A provider that cannot be opened (missing file, no sk_api_version, wrong major version) is reported before the key is offered and authentication continues; a failure inside sk_sign after the server has accepted the key (device absent, PIN required in BatchMode, provider error) prints security key signing failed for <path>: ... and authentication continues with the next identity on the same connection, as after OpenSSH's sign_and_send_pubkey failure: the signer hands russh the request back unsigned, russh sends nothing for it, and bssh stops waiting for the reply. Provider calls are serialized process-wide, because sk-api makes no thread-safety promise and bssh may authenticate to many hosts at once. An sk-* identity is checked against the provider from its unencrypted public half before any passphrase prompt, and ~/.ssh/id_ed25519_sk and ~/.ssh/id_ecdsa_sk are among the default identities. Static musl release builds cannot dlopen; they build, and report that limitation when an external provider is configured. Host keys and host certificates of the sk-* types are verified by ssh-key's sk verifiers (SHA256(application) || flags || counter || SHA256(message)), with no flag policy on the client side, as in OpenSSH. Agent-held sk-* keys keep signing through the agent. -Q key-plain, -Q key, -Q key-cert, -Q key-sig, HostKeyAlgorithms and PubkeyAcceptedAlgorithms list the sk-* names in the reference order; the remaining WebAuthn difference is tracked in #345.

ssh_config integration

Each first-wave directive in #281 has a runtime consumer and behavior/policy test. Registry tests in src/ssh/ssh_config/parser/options/support.rs enforce one classification per keyword/alias. canonical_unimplemented_and_unknown_diagnostics_use_real_source_and_log_file checks named, source-located, once-only warnings. These checks prevent silent discard, not all semantic incompatibility.

Named-regress acceptance is separate: historical results include candidate failures in dynamic-forward, percent and rekey, environmental forwarding, and a whitespace-path-related ssh-tty skip. Environmental evidence is not a candidate pass. #281 stays open until integrated regression and behavior requirements are satisfied or explicitly revised.

Previously excluded scope

#275 excluded GSSAPI, PKCS#11 and FIDO middleware, X11, tun forwarding, KRL generation, CA signing, sshd configuration tests and PuTTY/Dropbear/Twisted conch/ssh.com interoperability. #328 and #331 reversed the FIDO half of that exclusion: sk-* keys are supported through the built-in internal provider or an external SecurityKeyProvider library, matching OpenSSH 10.3p1 built with its internal provider. PKCS#11 stays excluded and its manifest rows preserve that reason. cert-userkey, named by #281, is permanently skipped for CA signing; it must not be marked passed.

These exclusions bounded the original score-gated epic, not full compatibility. Revisit them explicitly for a broader replacement contract. Distinguish server-only tooling and third-party interoperability from the desired ssh(1) surface instead of silently declaring them implemented. Unsupported configuration requires explicit diagnostics until runtime support exists.

Dependency boundary: destination-constrained agents

agent-restrict requires OpenSSH session-bind@openssh.com before agent identity listing. russh 0.65.0 (Handle::agent_session_binding and AgentClient::bind_session, upstream #794) exposes the proof tuple from the initial key exchange: the exact negotiated host-key/certificate blob, session ID, and server KEX signature. bssh binds each agent connection used for direct authentication with the forwarding flag clear and each relayed forwarded-agent connection with it set. As in ssh_agent_bind_hostkey, an agent's refusal is not fatal, and an enforcing agent still refuses constrained keys on an unbound connection. Constraints must never be dropped to make authentication succeed.

The remaining gap is also a dependency boundary. A signature made through a forwarded agent must come from a publickey-hostbound-v00@openssh.com userauth request carrying the server host key, or ssh-agent refuses it (no hostkey recorded in signature for forwarded connection). russh 0.65.0 always sends method publickey and bssh cannot change that from a Signer, so multihop restricted, multihop username, multihop wildcard username, and multihop cycle restricted allow stay failing. PR #317 removed the maintained russh fork after required APIs landed upstream, and PR #320 similarly returned SFTP to upstream, so the preferred route is again an upstream API consumed from a published release. A contributor-fork bridge or vendored implementation requires separate approval, a removal plan, and the same protocol tests.

Follow-up validation checkpoints

The following focused checks were performed on a Linux aarch64 host while closing #314. They are not a full integrated two-platform result and do not lower either committed score floor. The regress directory on that host is longer than sockaddr_un allows, so the pinned harness classifies multiplex and agent-restrict as environmental there (the reference client fails the same way); the Unix-socket phases were run through a short symlinked OBJ directory instead.

  • rekey: pinned harness passes in 114.3 s (reference client 114.5 s on the same host, 105 s of it sleeping); the manifest minimum was raised to 180 s with those numbers.
  • multiplex: passes in 72.1 s through the short OBJ path, including the TCP forward phase, Unix-domain forward, and the TCP and Unix -O forward/-O cancel phases.
  • hostkey-agent: every phase passes, including the two sk-* certificate phases that #328 added (the regress tree supplies sk-dummy.so through SSH_SK_PROVIDER). An explicit certificate-only HostKeyAlgorithms restriction is honored instead of being widened to the default certificate list; certificate_only_host_key_algorithms_are_never_widened in connection_tests.rs keeps it that way.
  • keytype, limit-keytype and agent: pass with the sk-* key types active. keytype signs user authentication with ed25519-sk and ecdsa-sk identity files through the provider.
  • agent-restrict: through the short OBJ path, every phase passed except the eight that needed session-bind@openssh.com (#327; four remain after russh 0.65, see the dependency boundary above), including the certificate hosts host_d and host_e in the w/o agent and unrestricted phases.

The earlier macOS checkpoints from the first #314 follow-up are kept below for history.

  • dynamic-forward: pinned harness passes (35.3 seconds), including local and remote dynamic SOCKS phases.
  • percent: pinned harness passes (42.977 seconds) after destination User/Port is reflected in trusted file preprocessing.
  • rekey: pinned harness passes (142.750 seconds). Diagnostic lines come from actual completed KEX events and respect the effective debug LogLevel; no synthetic exchange counts are emitted.
  • proxyjump: pinned harness passes (4.887 seconds). Five focused parser/chain tests also pass.
  • scp3: candidate now completes all legacy SCP and SFTP cases instead of hanging on the first pipe-backed session; candidate and reference encounter the same macOS symlink/unsafe temporary-path failure, so the pinned verdict remains environmental (7.519 seconds), not pass. An explicit legacy scp -O -3 1 MiB remote-to-remote copy succeeds with matching bytes. The cancellable pipe/socket stdin helper has five passing focused tests, including regular-file routing, buffered-socket draining and fail-closed O_RDWR FIFO handling.
  • multiplex: pinned test remains failed (78.3 seconds), with Unix-domain forwarding and control forward/cancel failures. Endpoint/negotiated-algorithm conninfo, check/exit/stop, status and TCP phases pass. Snapshot SHA-256: bc9ca3e4f9d672d3416a9f3a8fe8a538d8db3e2f8b19f8028fbee6085551c58b. Passing passenger-emulated proxy phases does not establish raw mux-v4 proxy support.
  • agent-restrict (historical): unrestricted/offline-private-key phase passes; destination restrictions were blocked on the upstream binding API, which russh 0.65.0 now provides.
  • hostkey-agent (historical): plain host-key algorithms pass; the certificate slice of that time was removed.

Security regression coverage preserves trusted-file-only shell Match execution, bounded SOCKS negotiation, and first-obtained fail-closed PermitRemoteOpen. Host-certificate authority validation, certificate revocation and CASignatureAlgorithms policy are implemented and covered by unit tests in src/ssh/tokio_client/host_certificate.rs and host_verification.rs.

The binding API proposal is russh PR #794. Dependency adoption is conditional on upstream merge: only an immutable merged revision from the official upstream may be used temporarily, followed by a crates.io release. An unmerged contributor branch is not an approved dependency. Current code must continue to fail closed on unsupported agent constraints.

Remaining control details include complete forwarding-channel enumeration, allocated remote-port replies, multiplexed -W, TTY-failure notifications and ~user expansion. Unix-domain forwarding is implemented; raw mux-v4 interoperability is not. Eager zlib is validated; delayed zlib@openssh.com is not advertised. Non-pipe/socket character-device stdin still uses the existing blocking adapter; the SCP fix does not claim every stdin source is cancellation-safe.

Server security-key authorization

bssh-server fails closed for sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-nistp256@openssh.com user keys: russh does not expose signature UP/UV flags to the authentication callback. An authorized_keys line must have no-touch-required and must not have verify-required to authorize either type. The default touch policy and every verification-required policy are rejected and logged at info level. Ordinary keys are unaffected. This server restriction is distinct from client-side security-key signing and host-key verification described above; #340 tracks actual signature-flag enforcement. Security-key user certificates remain out of scope.

For duplicate user-key entries, the first matching authorized_keys line determines the security-key policy. A later no-touch-required entry cannot override an earlier matching line that requires touch or verification; unrelated keys are skipped.