Skip to content
Repos

TOSV

Markdown 3.5 KB69 lines Opens in site

Directory Raw Download

0010: optional in-binary TLS 1.3 with hybrid PQ key exchange, and SSH PQ-only switch

  • Status: superseded by ADR 0011 (OpenSSL build removed 2026-11-05)
  • Date: 2026-11-05
  • Decision makers: retoor
  • Spec IDs: SEC-10, SEC-11, SF-62, FR-17, R-16 to R-20
  • Supersedes in part: D-05, NG-02, PIN-07 (TLS none in binary), PIN-06 (loopback only when TLS is off)
  • Audit: quantum posture

Context

The quantum audit found HTTP and WebDAV transit has no PQ guarantee (R-16): TLS lived in stunnel with an unpinned group. Constraint from the owner: only static-compilable options. wolfSSL was already rejected in ADR 0008 (GPLv3). OpenSSL 3.5 is Apache-2.0, supports TLS 1.3 and the X25519MLKEM768 hybrid group natively, and has static archives.

Decision

  • TLS is a build option: make TLS=1 defines TOSV_TLS and links static libssl.a and libcrypto.a from SSL_PREFIX (default third_party/build). The default build has no TLS code path and no OpenSSL dependency, so NFR-02 and NFR-05 hold for it.
  • Runtime enable: TOSV_TLS_CERT plus TOSV_TLS_KEY (PEM). Only one set is a startup error. A non-TLS build given those variables refuses to start (loud, never silent plaintext).
  • Policy: TLS 1.3 only. Groups X25519MLKEM768:X25519; with TOSV_TLS_PQ_ONLY=1 only X25519MLKEM768.
  • Bind: default stays 127.0.0.1. TOSV_BIND to any other address is refused unless TLS is enabled.
  • Shape: accept loop hands the socket to a pump thread that runs SSL_accept and relays to one end of a socketpair; the unchanged handler uses the other end. Peer IP is passed through, so IP gates and rate limits keep the real address. Cap: 128 concurrent TLS connections, 60s idle, 30s handshake and send timeouts.
  • SSH: TOSV_SFTP_PQ_ONLY=1 removes curve25519 from offer and accept (SF-62). Default off, pending client coverage data (ADR 0009).
  • Re-store: tosv --restore-v2 [--apply] converts v1 blobs (FR-17).

Consequences

  • Tested 2026-11-05 against a dynamically linked build of the same source: TLS 1.3 with X25519MLKEM768 and an Ed25519 certificate, 5MB store plus fetch byte-identical, plain HTTP refused, PQ-only mode refuses an X25519-only client.
  • Static link (done): the distro libcrypto.a needs libjitterentropy, which is not installed, so it was not used. OpenSSL 3.5.5 is vendored by scripts/vendor-openssl.sh (size plus sha256 pin) and built by make openssl with no-shared no-dso no-engine no-legacy no-comp no-zlib no-zstd no-brotli into third_party/build. Measured 2026-11-05 on a 12-core machine: build 41s wall, libcrypto.a 12.2MB, libssl.a 2.1MB. make TLS=1 tosv links static: ldd shows no ssl or crypto shared deps; binary 7.98MB (7.07MB stripped).
  • Re-run of the same live checks on the static binary: TLS 1.3 with X25519MLKEM768, 8MB store plus fetch identical, X25519-only client refused in PQ-only mode.
  • Pin gap: the tarball hash comes from a single source (GitHub release over TLS); no second hash was found to cross-check.
  • NFR-05 amended: default binary stays under 5MB (628KB measured); the TLS build is 7.98MB, an accepted exception. Switching TLS on or off requires rm tosv before make, the Makefile does not track the flag.
  • Certificate and host identity stay classical (Ed25519 or RSA/ECDSA): protects against recorded traffic, not a live quantum forger. Same honest limit as ADR 0009.
  • The session cookie has no Secure flag; unchanged.
  • Dependency added to the TLS build only: OpenSSL 3.5.x.
49.5ms