A hybrid controller always double-signed the COM, so it serialized with type
byte 2. A legacy (v1.14.1) client's COM parser rejects any type != 1, which
threw inside NetworkConfig::fromDictionary; handleConfigChunk swallowed it, so
the client sat at REQUESTING_CONFIGURATION forever and surfaced as
ACCESS_DENIED once the network was private and its member unapproved.
Advertise PQ capability in the network-config-request metadata ("f" bit 0,
previously hardcoded 0) and let the controller pick the wire form per
requester: type 2 only for a requester that flagged the bit, type 1 otherwise
(all legacy clients, and push configs with no request metadata).
Verified: selftest's new "PQ authority can issue classic COM on demand" case
passes, and a real v1.14.1 client reaches status OK / netconfRevision 5
against a pqcMode:hybrid controller while a hybrid client still comes up OK.
134 lines
34 KiB
Markdown
134 lines
34 KiB
Markdown
# SPEC — BackOne
|
||
|
||
## §G (goal)
|
||
|
||
Make BackOne quantum ready: phases 1-6 of `backone-quantum-fork-research.md` — liboqs + hybrid X25519+ML-KEM-768 / Ed25519+ML-DSA-65 handshake, identity/COM v2 double-sign, capability-bit negotiation. Phase 7 (AES-256-GCM) OUT.
|
||
|
||
## §C (constraints)
|
||
|
||
- C++17. GNU make = real build. Top `CMakeLists.txt` = stub, never product build.
|
||
- Deps vendored in `ext/`. No new dep for few-liners.
|
||
- Tabs always, `.clang-format` LLVM/Stroustrup, indent 4. No reformat of untouched lines.
|
||
- New `.cpp/.hpp/.h` gets 11-line BSL header verbatim (`node/Mutex.hpp:1-12`).
|
||
- `node/` stays OS-independent. Sockets/files → `osdep/`. Orchestration → `service/`. Persistence → `controller/`.
|
||
- No exceptions across C API. Fatal `ZT_ResultCode` = 100–999.
|
||
- One reactor thread (`Phy::poll`). Cross-thread wake only `Phy::whack()`.
|
||
- New compiled file → register in `objects.mk` or no link.
|
||
- Platforms: Linux (primary), macOS, BSD/NetBSD, Windows (msbuild).
|
||
- Header edits: no `-MMD` dep tracking → `make clean` after touching `.h`.
|
||
- PQC lock: liboqs static vendored `ext/`; hybrid key = KDF(classical ‖ pq); presets `hybrid` (ML-KEM-768/ML-DSA-65) + `pqconly` (same parameter set as `hybrid` — not distinct, see T25)
|
||
- `pqconly` **enforces** a PQ-capable peer on member traffic; `hybrid` only prefers it. Both use the same ML-KEM-768/ML-DSA-65 material (V20, T25)
|
||
- wire/identity/COM use versioned v2 + capability-bit fallback to classic
|
||
- `include/ZeroTierOne.h` changes additive-only (Java/libzt ripple)
|
||
- controller SQL opt-out: `ZT_CONTROLLER_NO_SQL=1` strips `-DZT_CONTROLLER_USE_LIBPQ`, libpqxx/libpq, hiredis, redis++, `libsmeeclient.a`, `-DZT_NO_PEER_METRICS`. `ZT_CONTROLLER=1` keeps meaning (postgres available) so `make central-controller` + `ext/central-controller-docker/` don't break. Flag ⊥ redefine `ZT_CONTROLLER=1` — silent redefinition breaks existing postgres builders, loses the opt-out back
|
||
- no-sql build ∉ arch-pinned: no `libpq-dev`, no `ext/*/install/ubuntu22.04/$(EXT_ARCH)` paths, no rust toolchain → any Debian base ok. Vendored prebuilts are `ubuntu22.04`-only amd64+arm64 (V21)
|
||
- controller `⊥ OFF` by default: enabled unless `settings.disableController` (`OneService.cpp:1167`); image ! no `local.conf`. `FileDB` = default backend (`controller.d`, `OneService.cpp:907`)
|
||
- image: `debian:bookworm-slim` both stages. `CMD` exec daemon PID 1, ⊥ entrypoint wrapper. `VOLUME /var/lib/backone` so `identity.secret` + `controller.d` survive replacement — losing identity → new node address → re-authorize
|
||
- build gate ⊥ compile-success-only: postgres-present-unconfigured builds clean + silently falls back (B7 shape). Build ! start container + assert controller API answers
|
||
- OUT: AES-256-GCM swap, trusted-path skipCrypto, forward secrecy, protocol standardization, crypto audit, production release/signing
|
||
- `?` address v2 derivation keeping 40-bit + PoW
|
||
- `?` VL1 fragmentation capacity for +4KB identity (check `node/Packet.*`)
|
||
- `?` liboqs version/tag + build flags for `ext/`
|
||
- `?` measured ML-KEM/ML-DSA latency (doc estimates unverified)
|
||
- `?` capability-bit placement in existing handshake
|
||
|
||
## §I (public surfaces)
|
||
|
||
| id | surface | detail |
|
||
|---|---|---|
|
||
| I.capi | C API | `include/ZeroTierOne.h`, `ZT_Node_*` (lines 1796-2258), `ZT_SDK_API`. Ripples to Java/libzt/SDK |
|
||
| I.api | HTTP JSON API | `127.0.0.1:9993`, `/status /peer /network /member /controller /metrics /info`, auth `X-ZT1-Auth` header or `?auth=` from `authtoken.secret` |
|
||
| I.cli | CLI | `backone-cli info\|listpeers\|listnetworks\|join\|leave` (`-j -p -D`), `backone-idtool generate\|validate\|getpublic\|sign\|verify\|mkcom` — symlink dispatch on `argv[0]` |
|
||
| I.cfg | config | home `/var/lib/backone` (macOS `/Library/Application Support/BackOne`), `local.conf`, `identity.secret`, `networks.d/`, `controller.db`, `backone.port`, `backone.pid` |
|
||
| I.build | build | `make`, `make one`, `make selftest`, `make core`, `make debug`, `make install`, `make debian/redhat`, `make central-controller`; env `ZT_*` knobs |
|
||
| I.ffi | Rust FFI | `rustybits/zeroidc` (`zeroidc_new`…), `smeeclient` — C header `zeroidc.h`, link on `ZT_SSO_SUPPORTED=1`/`ZT_CONTROLLER=1` |
|
||
| I.jni | Java SDK | `java/jni/…Node.cpp`, ant targets `build_java/build_android/build_jar` |
|
||
| I.pqc.cfg | config | `local.conf` `settings.pqcMode` (off/hybrid/pqconly); **absent = off/classic (opt-in)**, unknown value = warn + classic. `hybrid` prefers PQ and silently falls back; `pqconly` refuses config/credentials from non-capable non-root peers (V20) — a policy mode, not just an identity selector. Per-algorithm `kem`/`sig` selection is *not* wired (research doc only, see T25) |
|
||
| I.pqc.wire | wire | static-static hybrid, no ephemeral exchange: identity v2 (type byte 1) stores ML-KEM-768 + ML-DSA-65 pub on disk, but HELLO carries only the classic projection (`Identity::serializeClassic`) so vanilla peers parse it; peer PQ keys arrive in `VERB_PQ_KEYS` (0x17); agree = KDF(X25519-identity-agree ‖ ML-KEM-encaps(peer static pub)); the agreed key is **confirmed** by a trailing 4 B tag in the same verb (optional, V19), since ML-KEM cannot report a mismatched decapsulation; capability via HELLO protocol-version high bit; `identity.secret`/`identity.public` v2 on disk |
|
||
| I.pqc.com | credentials | COM double-sign/verify — controller + `node/CertificateOfMembership.*` |
|
||
| I.ctlr.img | image | `Dockerfile.controller` — `debian:bookworm-slim` → `make ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one`; runtime stage `openssl` + `iproute2` only, ⊥ `libpq5`/rust. `VOLUME /var/lib/backone`, `CMD ["backone","-U","-p9993"]` |
|
||
| I.rules | rules compiler | `node rule-compiler/cli.js <rules>` → rules/tags JSON |
|
||
|
||
## §V (invariants)
|
||
|
||
Derived from `selftest.cpp` + CI gates. `?` = code-derived, no test yet.
|
||
|
||
| id | invariant | evidence |
|
||
|---|---|---|
|
||
| V1 | Crypto KATs pass: Salsa20 vectors, C25519 agreement, Ed25519 sign/verify, SHA512, Poly1305 | `selftest.cpp:137` `testCrypto` |
|
||
| V2 | Identity known-good accepted, known-bad rejected | `selftest.cpp:475` `testIdentity` |
|
||
| V3 | CertificateOfMembership signs and `agreesWith` roundtrip | `selftest.cpp:577` `testCertificate` |
|
||
| V4 | Packet encode/decode roundtrip exact | `selftest.cpp:641` `testPacket` |
|
||
| V5 | Phy UDP+TCP loopback on 127.0.0.1 works, no root | `selftest.cpp:1002` `testPhy` |
|
||
| V6 | Zero definite leaks under valgrind; test exit code 0 | `.github/workflows/validate-report.sh` |
|
||
| V7 | `?` No exception crosses C API; `ZT_ResultCode_isFatal` only 100–999 | `include/ZeroTierOne.h:426` |
|
||
| V8 | `?` `node/` contains no OS calls (sockets/files/interfaces) | `node/README.md` rule |
|
||
| V9 | hybrid↔vanilla negotiates classic, link stays up | interop matrix |
|
||
| V10 | identity v2 survives 1280B MTU tunnel intact; v2 = type byte 1 (wire `Identity.hpp:219`, string slot `Identity.cpp:173`); address derivation hashes X25519 material only → v1/v2 addresses bit-identical; v1 parser rejects type ≠ 0 cleanly | interop matrix |
|
||
| V11 | ML-KEM/ML-DSA KATs + hybrid KDF vector + identity v2 roundtrip + COM double-sign verify pass | extended `selftest.cpp` |
|
||
| V12 | `pqcMode` negotiation honors `local.conf` (`off` -> no v2 fields) | live daemon: bogus `settings.pqcMode` -> `WARNING` (`service/OneService.cpp:1478`), `hybrid` -> clean (2026-10-03); `selftest` has no `pqcMode` coverage |
|
||
| V13 | hybrid agree = KDF(X25519-identity-agree ‖ ML-KEM static-static), no ephemeral exchange; hybrid↔hybrid agree + hybrid↔vanilla classic fallback pass | `node/Peer.cpp` `ensurePendingHybridCt` (encaps) / `setHybridSessionKey` (install); `node/IncomingPacket.cpp` `_doPQ_KEYS` (parse + decaps) |
|
||
| V14 | COM double-sign = type byte 1→2 appends ML-DSA sig alongside Ed25519; v1 verify path unchanged; v1 rejects type 2 cleanly | `node/CertificateOfMembership.hpp:222-296`, `node/CertificateOfMembership.cpp:97-162`, `selftest.cpp:717` |
|
||
| V15 | handshake vs fragment loss measured: classic HELLO stays 137 B → 1 frag in every mode (max 7 `Packet.hpp:235`); PQ material moved off the critical path, so HELLO no longer depends on fragment reassembly | `selftest.cpp` PQ section |
|
||
| V16 | hybrid handshake puts a 1088 B ML-KEM-768 ct on the wire and both sides derive the same hybrid `_key`; classic/off peers never receive `VERB_PQ_KEYS` and fall back | see V17 for the live evidence |
|
||
| V17 | PQ public keys travel out of band in `VERB_PQ_KEYS` (0x17), never inside HELLO: HELLO carries only `Identity::serializeClassic` so a vanilla peer can parse it, and `VERB_PQ_KEYS` (4253 B → 3 frags) carries ML-KEM-768 + ML-DSA-65 public keys plus, from the lowest address, the 1088 B ct. Flag byte: bit0 = ct present, bit1 = "I already hold your keys" (ends the retry loop). A 4 B key-confirmation tag follows the keys (after the ct when present), see V19. | 2-node moon lab: `pqcCapable:true`, `pqcHybridActive:true`, 3 active direct paths at 172.31.0.1/19993 (2026-10-06) |
|
||
| V18 | FLAGS is inside the AES-GMAC-SIV AAD and `dearmor` keeps the FRAGMENTED bit, so `setFragmented(true)` must precede `armor()`; `Switch::_sendViaSpecificPath` may not set it on an already-armored packet. `dearmor` decrypts to scratch and commits only on success, so a failed attempt does not destroy the ciphertext a later key would need. | `selftest.cpp` PQ section: fragmented pre-armed packet dearmors, late-set flag does not (verified `FAIL-AS-EXPECTED`) |
|
||
| V19 | The hybrid session key is **confirmed**, never merely assumed. ML-KEM uses implicit rejection: decapsulating with a secret that does not match the peer's public key returns a well-formed but *wrong* shared secret instead of an error, so a peer whose PQ material drifted derived a different key, believed agreement succeeded, and every data frame then failed its MAC — with `_pqKeysAcked` already latched at the first handshake, so the retry timer never fired again and only a one-sided daemon restart recovered. A 4 B tag = `HMAC-SHA384(_key, peer_address)`, under its own KBKDF label (`ZT_KBKDF_LABEL_PQ_CONFIRM '2'`) so it cannot collide with session-key material, rides at the end of `VERB_PQ_KEYS` and is optional on the wire (a build without it still interoperates). Mismatch → `resetPQExchange()`, which reverts `_key` to classical, so the inbound path's hybrid-then-classical fallback (`IncomingPacket.cpp`) keeps working throughout. A peer that rolled its PQ keys still holds ours and therefore sets the ack bit in the very message where the rotation is detected, so that ack is dropped for that exchange — honouring it would re-latch the state just cleared and suppress the reply that carries the fresh ciphertext. | `selftest.cpp` "Key confirmation detects mismatched hybrid key"; direct test against `libbackonecore.a`: honest session confirms, mismatched derivation is caught, renegotiation converges to agreeing keys. Live 2-node hybrid session (n2 joins n1's network) produced zero confirmation failures, so healthy sessions are not reset |
|
||
| V20 | `pqconly` is a **policy** mode, not an identity selector. Under `pqconly` a non-capable non-root peer is refused `VERB_NETWORK_CONFIG`, `VERB_NETWORK_CREDENTIALS` **and `VERB_NETWORK_CONFIG_REQUEST`**, so no network comes up over a silently classical link and no COM establishes trust across one; PLANET/MOON roles are exempt because all four Earth roots report `pqcCapable:false` and enforcing against them would cut the node off from the root topology. The third verb is load-bearing and was **measured, not assumed**: gating only the two receive-side verbs left a classical peer able to join, because membership is granted by the *serve* direction — the classic peer asks the pqconly node's controller for its config and the node enforcing the policy was the one handing it over (0% loss, network `OK`, counter incrementing in the unrelated direction). The gate keys on `_hybridCapable` (fixed at HELLO), **not** `hybridSessionKeyInstalled()`, because the encapsulating peer stages its hybrid key until the confirm tag arrives and would otherwise be rejected for the whole staging window. `hybrid` keeps the silent classical fallback but now logs a downgrade `WARNING` once per peer (re-armed on recovery), so a downgraded link is no longer invisible. | `docs/pqconly-mode-test.md` §4a records the hole and the fix; measured 2026-10-08 on the two-host lab: before this change a `pqconly` node held 3 paths to a fully classical peer at 0% loss; after it the classical peer sits at `REQUESTING_CONFIGURATION` with `assignedAddresses:[]` and 100% loss, while two `pqconly` nodes hold 0% loss in both directions with no false rejection. Refusals are countable via `pkt_network_config_in_pqconly_rejected` / `pkt_network_credentials_in_pqconly_rejected` |
|
||
| V21 | `ZT_CONTROLLER_NO_SQL=1` → binary ∌ PostgreSQL/Redis/smeeclient symbols, and the embedded controller still runs on `FileDB`. Every symbol `ZT_CONTROLLER=1` adds has `controller/PostgreSQL.cpp` as its sole consumer (verified by grep: libpqxx, hiredis, redis++, `smeeclient` appear nowhere else), and both `PostgreSQL.hpp` and `PostgreSQL.cpp` are wholly wrapped in `#ifdef ZT_CONTROLLER_USE_LIBPQ`, so the file compiles to nothing when the define is absent. `RedisConfig *_rc` (`service/OneService.cpp:900`) and `_controllerDbPath` (`:907`) stay unconditional, so `FileDB` still receives a path. `EmbeddedNetworkController::init` (`controller/EmbeddedNetworkController.cpp:535-541`) falls to `FileDB` when the define is absent. | build: `nm -C backone \| grep -iE "pqxx\|PostgreSQL::\|sw::redis\|smeeclient"` → no matches; container → `GET /controller/network/<id>` returns JSON; binary `-v` matches `version.h` |
|
||
| V22 | `ZT_CONTROLLER=1` without `ZT_CONTROLLER_NO_SQL=1` → same link line as before this flag existed. The flag is additive opt-out; ⊥ redefine `ZT_CONTROLLER=1` to mean no-sql. | build: `make ZT_CONTROLLER=1 one` on a box with the `ext/` prebuilts links as it did on 2.0.2; `ext/central-controller-docker/Dockerfile` still valid |
|
||
| V23 | A pre-PQ peer must reach `OK` against a `hybrid` controller. The controller issues a classic type-1 COM to any requester whose `VERB_NETWORK_CONFIG_REQUEST` metadata flags omit `ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE`; type 2 goes only to a requester that advertised the bit. Push configs (`requestPacketId == 0xffff...`, no requester metadata) also get type 1. | `controller/EmbeddedNetworkController.cpp:2039-2045`, `node/CertificateOfMembership.cpp:97,110-113`, `node/Network.cpp:1314`, `node/NetworkConfig.hpp:135-139`, `selftest.cpp:812` |
|
||
|
||
## §T (tasks)
|
||
|
||
| id | status | task | cites |
|
||
|---|---|---|---|
|
||
| T1 | x | Fix CI build smoke: `build.yml` runs `./zerotier-selftest`, build emits `backone-selftest` (also `tar zerotier-one` → `backone`) | I.build,V6 |
|
||
| T2 | x | Fix `validate-linux.sh` binary names: invokes `./zerotier-one`, `./zerotier-cli` (lines 41-43,105,111,451), builds `backone*` | I.cli,V6 |
|
||
| T3 | x | Wire `ZT_COVERAGE` into makefiles — consumed by none, gcovr likely reports zeros `?` | I.build |
|
||
| T4 | x | `make install` manpage rule: expects `doc/backone.8`, `doc/backone-cli.1`, `doc/backone-idtool.1`; `doc/` only has `zerotier-*`, no rename rule | I.build |
|
||
| T5 | x | `make redhat`: `backone.spec` %install copies missing `debian/backone.service` + `ext/installfiles/linux/backone.init.rhel6` (actual files `zerotier-*`) | I.build |
|
||
| T6 | x | Rebrand `make-bsd.mk`/`make-netbsd.mk`: still emit/install `zerotier-one`, `/var/db/zerotier-one` vs code writing `backone.pid` | I.build |
|
||
| T7 | x | `Dockerfile.ci`: copies `zerotier-one` from build → fails; binary is `backone` | I.build |
|
||
| T8 | . | `pkg/snap/snapcraft.yaml`: builds upstream `github.com/zerotier/zerotierone.git`, expects `usr/sbin/zerotier-one` | I.build |
|
||
| T9 | . | Wire orphaned `java/test/StringUtilsTest.java` (JUnit4) into `java/build.xml` target or delete | I.jni |
|
||
| T10 | . | Replace `rule-compiler/package.json` `npm test` failing placeholder with real test of `rule-compiler.js` | I.rules |
|
||
| T11 | . | `?` Add `#[test]` coverage for `rustybits/zeroidc` FFI parse/exchange paths | I.ffi,V7 |
|
||
| T12 | x | Implement Redis config TODO (`service/OneService.cpp:1467` `// TODO: Redis config`) | I.cfg |
|
||
| T13 | . | Implement `LFDB::eraseNetwork`/`eraseMember` TODOs (`controller/LFDB.cpp:383,388`) | I.cfg |
|
||
| T14 | . | ~~Lint gate~~ done: `make lint` (`tools/lint.sh`, changed-lines clang-format) + `.github/workflows/lint.yml` | I.build |
|
||
| T15 | . | Fix `-Wsign-compare` suppression FIXME (`node/Bond.cpp:23`, `node/Node.cpp:40`) | I.build |
|
||
| T16 | x | Federation identity-collision payload FIXME (`node/IncomingPacket.cpp:211`) `?` scope | I.capi,V7 |
|
||
| T17 | x | Phase 1: vendor liboqs static into `ext/`, wire `make-linux.mk` + `objects.mk`, pin version/tag + flags | I.build |
|
||
| T18 | x | Phase 2: `node/PQHybrid.*` hybrid agree = KDF(X25519-identity-agree ‖ ML-KEM-768 encaps over peer static pub); phase-2 ephemeral-field mockup dropped | I.pqc.wire,V13 |
|
||
| T19 | x | Phase 3: identity v2 type byte 1, append ML-KEM+ML-DSA pubs, address hash X25519-only, v1 clean reject type ≠ 0 | I.pqc.wire,V10 |
|
||
| T20 | x | Phase 4: COM type byte 2 double-sign (Ed25519+ML-DSA-65), v1 rejects cleanly | I.pqc.com,V14 |
|
||
| T21 | . | Phase 5: `local.conf` `settings.pqcMode` parse (off/hybrid/pqconly) + capability negotiation via HELLO protocol-version bytes, fallback classic. Mode now selects *whether* PQ material is used; *which* preset is still hardcoded (T24) | I.pqc.cfg,V12,V9 |
|
||
| T22 | x | Phase 6: selftest extension — ML-KEM/ML-DSA KATs, hybrid KDF vector, identity v2 roundtrip + address stability, COM double-sign, interop hybrid↔vanilla matrix | I.build,V11,V10,V14 |
|
||
| T23 | x | Phase 6: handshake-vs-fragment-loss benchmark for PQC HELLO; cap/segment if loss breaks handshake | V15 |
|
||
| T24 | x | Plumb `settings.pqcMode` through the identity path: `Node(…,int pqcMode)` stores `_pqcMode`; `Identity::generate(bool pq,int pqcMode)` derives `pq` from the daemon mode; `OneService` reads `local.conf` before `new Node` — a fresh hybrid/pqconly node writes a type-1 identity, a classic one type-0. Fixes the G1 defect. | I.pqc.cfg,V12 |
|
||
| T25 | . | Distinct PQ parameter sets: `node/PQHybrid.*` hardcodes ML-KEM-768/ML-DSA-65 (`PQHybrid.cpp` static_asserts `OQS_KEM_ml_kem_768`/`OQS_SIG_ml_dsa_65`), so `hybrid` and `pqconly` select identical *cryptographic material*. `pqconly` is nonetheless behaviorally distinct — it enforces the peer requirement (V20) — but §C's "ML-KEM-1024/ML-DSA-87 for `pqconly`" was never implemented and has been removed. Parameterize the preset (key sizes, ct len, `_pendingHybridCt` buffer) only if stronger parameters are actually wanted; the HELLO MTU objection no longer applies (PQ material rides in `VERB_PQ_KEYS`, V17), so the only remaining coupling is the buffer sizes in `Peer.hpp`. | I.pqc.wire,I.pqc.cfg,V15,V17,V20 |
|
||
| T26 | . | Expose real PQ state in `/peer`: `pqcCapable`/`pqcHybridActive` are copied from the `ZT_Peer` snapshot, which never populates them, so both always read `false` (B6). Add a `Node` accessor for a live peer by address and populate both fields in the three `_peerToJson` call sites. Needs a `ZT_Node` C API entry point, so it ripples to `include/ZeroTierOne.h`, `java/jni`, and the SDKs — budget for that rather than reaching into `node/` from `service/`. | I.pqc.wire,I.capi,V19 |
|
||
| T27 | x | Add `ZT_CONTROLLER_NO_SQL=1` to `make-linux.mk` (and any mac/bsd mirror carrying the same block): when set, suppress `-DZT_CONTROLLER_USE_LIBPQ`, libpqxx/libpq, hiredis, redis++, `libsmeeclient.a`, the `smeeclient` cargo prerequisite, and `-DZT_NO_PEER_METRICS`. Keep the whole `ZT_CONTROLLER=1` block untouched when the flag is unset. Check `objects.mk` for `controller/PostgreSQL.o` — if it links the empty translation unit that is harmless, but confirm the guard (`controller/PostgreSQL.cpp:12-16` … final `#endif`) covers every symbol so `nm` is clean. Verified: `ZT_CONTROLLER=1` flag dump byte-identical to pre-edit (V22); no-sql build has 0 `pqxx|PostgreSQL::|sw::redis|smeeclient` symbols, no `postgres:` string, no libpq/ssl in `ldd`; live daemon created + authorized + listed a member through the FileDB controller (V21). | I.build,V21,V22 |
|
||
| T28 | x | Write `Dockerfile.controller`: `debian:bookworm-slim` builder (build-essential clang pkg-config libssl-dev curl) → `make ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one`; runtime stage `bookworm-slim` + `openssl` + `iproute2`, `COPY --from=builder` the binary and `backone-cli`/`backone-idtool` symlinks, `VOLUME /var/lib/backone`, `CMD ["backone","-U","-p9993"]`. ⊥ `entrypoint.sh.release` wrapper. `COPY . .` the tree — `ext/` prebuilts are `ubuntu22.04`-only and must never be referenced (V21). Also required a root `.dockerignore`: the checkout ships 121 stale `.o` built against glibc 2.43, and the image's is 2.36, so `COPY . .` linked host objects and failed with `undefined reference to __isoc23_strtoull`. Patterns must be `**/*.o` — bare `*.o` matches root only and lets `node/Switch.o` through (B8). | I.ctlr.img,V21 |
|
||
| T29 | x | Build gate in the Dockerfile: after the build, `docker run` the image, `curl` the controller API, assert real JSON membership — compile success alone proves nothing, since postgres-present-unconfigured builds clean and falls back silently. Ship the gate as a script under `tools/` so it is runnable outside the image too. Shipped as `tools/controller-image-gate.sh` (`--local` / `--image NAME` / `--port N`), asserting: 0 `pqxx|PostgreSQL::|sw::redis|smeeclient` symbols, no libpq/libssl in `ldd`, `/status` `online:true`, controller creates a network, authorizes a member, reads it back, and wrote `controller.d/network/<nwid>.json`. A second assertion lives in the Dockerfile itself (`! nm -C backone \| grep -qiE …`). | I.ctlr.img,I.api,V21 |
|
||
|
||
T1/T2 = prerequisites — CI must invoke `backone-selftest` before PQC gates mean anything. T1–T16 backlog (rebrand/CI/lint leftovers); T17–T25 = PQC phases 1–6 + the pqconly preset gap; T26 = PQ state is not observable via `/peer`. T27–T29 = controller packaging (`ZT_CONTROLLER_NO_SQL` flag, `Dockerfile.controller`, runtime gate) — independent of the PQC work, sequential inside itself.
|
||
|
||
Not tracked (low value `?`): `one.cpp:256` port/token cleanup, `MacKextEthernetTap.cpp:480` iface status, VLAN TODOs in `NetBSDEthernetTap.cpp:468`/`MacKextEthernetTap.cpp:685`, `Phy.hpp:325` unix sock type comment.
|
||
|
||
## §B (bug log)
|
||
|
||
| id | date | cause | fix |
|
||
|---|---|---|---|
|
||
| B1 | 2026-10-02 | Phase 5 (T21) advertised PQC capability in HELLO but never consumed it: `Peer::_key` was derived classically in the constructor and the hybrid ciphertext had no place in the HELLO/OK(HELLO) layout, so `hybridEligible()` was dead. | Wire hybrid static-static KEM ct into HELLO (lowest-address side writes `[moon count][moons][flag(1B)][ct 1088B]`, crypted with the classical key) and echo it in OK(HELLO); parser order matches `Peer::sendHELLO`/`_doHELLO`; `Peer::ensurePendingHybridCt()` lazily encapsulates on first capability sighting so the handshake completes in one round trip; direction guard `sender == lowest address` on both parses. Refuse to start when the on-disk identity cannot satisfy `settings.pqcMode` (classic↔PQ migration changes the address). |
|
||
| B2 | 2026-10-02 | `settings.pqcMode` absent (or unrecognized) resolved to HYBRID, and `Node`'s `pqcMode` default was HYBRID with no way to tell "unconfigured" from "configured hybrid". Every existing type-0 install would hit the B1 refusal guard at startup; the C API `ZT_Node_new` path would silently generate type-1 identities. | Absent/unknown `settings.pqcMode` now resolves to `ZT_PQC_MODE_CLASSIC` (PQC is opt-in, matching the research doc); `Node(…,int pqcMode = ZT_PQC_MODE_CLASSIC)`. Verified: classic identity + no config boots on 2.0.0 and stays 141 B; fresh node w/o config makes type-0; fresh node with `"hybrid"` makes type-1 (6415 B); classic + explicit `"off"` boots; classic + explicit `"hybrid"` still refuses; unknown value warns and runs classic. |
|
||
| B3 | 2026-10-06 | The hybrid handshake never completed. Three defects stacked: (a) HELLO carried the full 6415 B type-1 identity, so every peer had to reassemble a 3-fragment packet before it could even answer, and a vanilla peer could not parse it at all; (b) `Switch::_sendViaSpecificPath` called `packet.setFragmented(...)` on packets that were already armored — FLAGS is inside the AES-GMAC-SIV AAD, so flipping the bit after `armor()` invalidated the MAC and the receiver dropped every `VERB_PQ_KEYS` as "invalid MAC"; (c) `Packet::dearmor` decrypted in place, so a failed attempt destroyed the ciphertext a later key would need. | PQ material moved out of HELLO into `VERB_PQ_KEYS`; HELLO now emits only `Identity::serializeClassic`. `_sendViaSpecificPath` sets FRAGMENTED only on unencrypted packets; `sendPQKeys` sets it before `armor()`. `dearmor` decrypts to a scratch buffer and commits only on success. Regression test in `selftest.cpp` asserts both directions (fragmented-and-pre-armed authenticates; armed-then-flagged does not), verified failing against the old ordering. |
|
||
| B4 | 2026-10-06 | Reported symptom was `backone-cli peers` showing a wall of `PLANET -1 RELAY` rows. Two things were wrong with the reading: the leading `200` is the HTTP status code that `one.cpp:453` prints, not a peer count; and the rows are the four hardcoded Earth roots, which a host with no UDP egress to `9993.zerotier.com` can never reach — hence `RELAY` and latency `-1` with no path. | No code change. Documented here so the symptom is not re-read as a PQ failure: a node that cannot reach a root shows exactly this table, independent of `pqcMode`. |
|
||
| B5 | 2026-10-07 | A hybrid session could wedge permanently and silently. ML-KEM uses *implicit rejection*: `agreeHybridDecaps` with a secret that does not match the peer's public key returns a well-formed but **wrong** shared secret rather than an error, so both sides believed agreement had succeeded and installed it. A peer whose PQ material drifted (restore from backup, identity roll) derived a different key than its counterpart, and every data frame thereafter failed its MAC. `_pqKeysAcked` had already latched at the first handshake, so `pqKeysDue` never fired again and the retry path could not repair it — recovery required restarting one daemon. Compounding it, a peer that rolled its keys still holds ours and so sets the ack bit in the very message announcing the rotation, so the ack re-latched the state being cleared and suppressed the reply that carried the fresh ciphertext. | Added key confirmation: 4 B `HMAC-SHA384(_key, peer_address)` at the tail of `VERB_PQ_KEYS`, optional on the wire, under its own KBKDF label. Mismatch, or advertised public keys that differ from the installed ones, calls `resetPQExchange()` — drops the hybrid key, reverts `_key` to classical (the inbound hybrid-then-classical fallback keeps traffic alive throughout), re-arms the retry, and re-encapsulates. The stale ack is dropped for that exchange so the reply is not suppressed. `agreeHybridDecaps` failure is no longer silently ignored. Verified in `selftest.cpp` and directly against `libbackonecore.a`; live 2-node hybrid session shows zero false confirmations. |
|
||
| B6 | 2026-10-07 | *Reported wrong and withdrawn.* Originally logged as "`pqcCapable`/`pqcHybridActive` in `/peer` are copied from a `ZT_Peer` snapshot that never populates them, so both always report `false`." That was false: `Node::peers()` populates both at `node/Node.cpp:621,626` from `Peer::hybridCapable()` and `Peer::hybridSessionKeyInstalled()`, and no C API change was ever needed — the fields are BackOne additions to `ZT_Peer` itself (`include/ZeroTierOne.h:1460,1467`). What *was* true is narrower and much less interesting: a stale comment at `service/OneService.cpp:621` asserted the snapshot lacked the fields, which contradicted the two lines directly beneath it and would have sent the next reader looking for a missing C API accessor that already existed. The fields were always live. | Deleted the stale comment. No functional change. Verified against a live 2-node hybrid lab: `/peer` reports `pqcHybridActive:true` on both sides once the key is installed, and `false` on a classical peer — the same field `tools/pqc-lab.sh` G4 gates on. Kept here because "the observability does not exist" is an expensive wrong assumption to propagate into the C API surface. |
|
||
| B7 | 2026-10-08 | `pqconly` carried a false security assurance: its name, its `Identity.hpp:4` comment ("PQ-only identities, no classic fallback"), and `SPEC` §C all implied that a peer without PQ support would be refused. It refused nothing. The only site distinguishing the modes was identity generation (`Identity.cpp:109`); every runtime gate tested `pqcMode() != ZT_PQC_MODE_CLASSIC` (`Peer.hpp:434`, `Node.cpp:274`), so `hybrid` and `pqconly` shared a code path and a `pqconly` node forwarded packets to a fully classical peer with no warning of any kind. Measured on the two-host lab: a `pqconly` node reported `pqcCapable:false hybrid:false paths=3` against a classical peer and pinged it at 0% loss. An operator selecting `pqconly` for downgrade resistance got neither enforcement nor any signal. | `pqconly` is now enforced rather than merely named: `Peer::pqconlyPeerRejected()` refuses `VERB_NETWORK_CONFIG` and `VERB_NETWORK_CREDENTIALS` from non-capable non-root peers (credentials matters most — a COM is what establishes trust for a network). PLANET/MOON are exempt, because all four Earth roots are `pqcCapable:false` and enforcing against them would sever root topology. The gate keys on `_hybridCapable`, fixed at HELLO, so the encapsulating peer's staged-but-not-yet-installed key does not trigger a false rejection. `hybrid` keeps its fallback but emits a downgrade `WARNING` once per peer, re-armed on recovery. Refusals are counted in `pkt_network_config_in_pqconly_rejected` / `pkt_network_credentials_in_pqconly_rejected`. Verified: `pqcHybridActive` still `true` and 0% loss between two PQ peers; see `docs/pqconly-mode-test.md`. |
|
||
| B8 | 2026-10-12 | The first controller image build died at link with `undefined reference to __isoc23_strtoull` in `node/Identity.o`, `node/NetworkConfig.o`, `node/IncomingPacket.o`, `node/InetAddress.o`. Nothing was wrong with `ZT_CONTROLLER_NO_SQL` or the makefile. `Dockerfile.controller` does `COPY . .`, the checkout ships 121 prebuilt `.o` compiled against the host's glibc 2.43, the image is `bookworm-slim` with glibc 2.36 — so the image's linker consumed host objects referencing symbols that only glibc 2.38+ exports. This is the same stale-object hazard `AGENTS.md` already warns about for local builds, arriving through a channel that warning never covered. The first `.dockerignore` did not help, because it was wrong twice over: it carried a post-`COPY` `RUN printf > .dockerignore`, which is dead code (the daemon reads that file before the build stage runs), and its `*.o` / `*.a` patterns match the **root only** under Docker's `filepath.Match` semantics, so 121 of 121 objects were still copied. A green build was never reachable from this tree. | Root `.dockerignore` with `**/*.o` and `**/*.a`, so `node/Switch.o` and `ext/liboqs/**` are both excluded; plus the arch-pinned `ext/*/install` prebuilts and the three `ext/*/build` trees. Verified: the rebuilt image links clean from an empty context and the daemon in it serves the controller (T28, T29). |
|
||
| B9 | 2026-10-12 | The gate passed checks it never performed. Three defects, each a false green rather than a false red. (a) The image-symbol check ran `nm -C /usr/sbin/backone \| grep -qi …` inside the runtime image, which ships no `nm` — `sh: nm: not found` made the pipeline exit non-zero, `! …` invert it to success, and the check reported a clean binary while proving nothing. (b) `--image NAME` was documented as "test an existing image" but branched into `docker build`, so there was no way to gate a prebuilt image without rebuilding it. (c) The container ran with `-p 127.0.0.1:$PORT:9993`, and every API call returned `401` with body `{}`: the auth gate at `OneService.cpp:1859-1905` admits `IP_SCOPE_LOOPBACK` or a match in `settings.allowManagementFrom`, and a DNAT'd published port arrives sourced from the bridge gateway, which is neither. The gate then spent 30s waiting for an `online:true` that could never arrive. | (a) Replaced with `grep -qaE` on the binary, which the image does have, and it fails loudly rather than on a missing tool; the image was independently confirmed to have no `nm`/`strings`/`readelf` at all. (b) `--image` now skips the build, as its help text always claimed. (c) Gate container runs `--network host` so the request stays on loopback, matching the posture operators actually get; README.docker.md now says `--network host`, not `-p 9993:9993`, and explains the `allowManagementFrom` route for reaching the API off-host. Verified: gate PASSes on the built image and in `--local` mode, driving create → authorize → list → on-disk write. |
|
||
| B10 | 2026-12-04 | `pqcMode:hybrid` controller refused every legacy (v1.14.1) client: it always double-signed the COM, so the credential serialized with type byte 2, and the legacy `CertificateOfMembership::deserialize` throws `INVALID_SERIALIZED_DATA_INVALID_TYPE` on any byte != 1. `NetworkConfig::fromDictionary` then threw, `Network::handleConfigChunk` caught and dropped the chunk, and the client sat at `REQUESTING_CONFIGURATION` forever, surfacing as `ACCESS_DENIED` once the network was private and its member unapproved. Measured on the lab pair: controller `tx network_config` ≈3 per join with 1432+1432+1106-byte chunks arriving at the client (tcpdump), client `netconfRevision:0`, `status:REQUESTING_CONFIGURATION`; the same client against a classic-mode controller came up immediately. Nothing in the request path exposed the requester's capability to the controller, so the wire form could not be chosen per requester. | `node/NetworkConfig.hpp:135-139` adds `ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE` (bit 0 of the existing `f` metadata key, previously hardcoded 0); `node/Network.cpp:1314` sets it when `pqcMode != classic`; `CertificateOfMembership::sign` takes `pqSign` and skips the ML-DSA half when false; the controller reads the flag and passes it. Non-flagging requesters — every legacy client, and push configs that carry no request metadata — get type 1. Verified: legacy client `status:OK`, `netconfRevision:5` against a `hybrid` controller; `selftest.cpp` `[certificate] PQ authority can issue classic COM on demand... PASS` |
|