8 Commits
Author SHA1 Message Date
proitlab cdcb1224cc chore: bump version to 2.0.4
Lint / clang-format (push) Canceled after 0s
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
Patch release for the classic-COM fix in 6c23665: a hybrid controller now
issues a type-1 certificate of membership to a requester that did not
advertise PQ capability, so pre-PQ clients can join again.

version.h revision 3 -> 4, with matching debian/changelog, RPM spec
version+changelog, and RELEASE-NOTES.md entries.
2026-12-04 18:09:41 +07:00
proitlab 6c23665072 fix(controller): issue classic COM to pre-PQ requesters
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
Lint / clang-format (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
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.
2026-12-04 18:00:43 +07:00
proitlabandClaude Opus 4.8 e5e2990a68 controller: ship a FileDB-only image and a gate that proves it runs
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
Lint / clang-format (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
ZT_CONTROLLER=1 on a box with libpq present but unconfigured compiles
clean and silently falls back, so a successful build proves nothing.
This adds the embedded controller as a buildable artifact and the check
that would have caught that failure.

ZT_CONTROLLER_NO_SQL=1 gates the SQL block and the smeeclient cargo
target, leaving the ZT_CONTROLLER=1 path byte-identical when unset.
Dropping it removes the arch-pinned ext/*/install/ubuntu22.04 prebuilts
and the rust toolchain from the build, so any Debian base works.

Dockerfile.controller builds that target into a 142MB runtime image.

Three defects surfaced while proving it, all logged in SPEC B8/B9:

- .dockerignore was inert twice over. Its patterns ran as a post-COPY
  RUN printf, which the daemon has already used by then, and bare *.o
  matches the root only under Docker's filepath.Match, so all 121 stale
  objects were copied and linked against the image's glibc 2.36. Now
  **/*.o, which is the known stale-object hazard from AGENTS.md.

- The gate asserted nm -C found nothing inside a runtime image with no
  nm. sh: nm: not found made the pipeline fail, ! inverted it to a pass,
  and the check went green on a missing tool. Uses grep -qaE instead.

- The container ran with -p, so every API call returned 401: OneService
  gates on loopback source at OneService.cpp:1859 unless
  allowManagementFrom widens it, and a DNAT'd port arrives from the
  bridge gateway. The gate uses --network host, and the docs now say so.

Verified: gate passes against the image and in --local, driving network
create, member authorize, member list and the on-disk write. Identity
and controller.d survive container replacement.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-12 06:31:22 +00:00
proitlab ecd6d86be1 release: 2.0.3
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
Lint / clang-format (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
Bump ZEROTIER_ONE_VERSION_REVISION 2 -> 3 and carry the release into the
packaging metadata: backone.spec Version plus a changelog entry, debian
changelog, and RELEASE-NOTES.md.

Release notes cover the pqconly enforcement work landed in 2e2b091: the
mode enforced nothing and was indistinguishable from hybrid, the first
gate still missed the config-serve direction that actually grants
membership, and the hybrid downgrade warning.

Notes the _hybridCapable latch as a known limitation rather than leaving
it undocumented.

Verified on a clean rebuild: binary reports 2.0.3, startup smoke exit 124
(healthy, no SIGSEGV), selftest exit 0.
2026-10-08 10:39:01 +00:00
proitlab 2e2b0910a8 pqconly: enforce PQ peers, including on the config-serve path
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
Lint / clang-format (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
`pqconly` selected a type-1 identity and then behaved exactly like
`hybrid` at runtime: every handshake gate tested only
`pqcMode() != CLASSIC`, so nothing distinguished the two modes and no
non-capable peer was ever refused. Measured on the two-host lab, a
`pqconly` node carried traffic with a fully classical peer at 0% loss.

Add `Peer::pqconlyPeerRejected()` - true when this node is exactly
`pqconly`, the peer did not advertise the HELLO capability bit, and its
role is not PLANET/MOON (all four Earth roots are `pqcCapable:false` and
enforcing against them would cut the node off the root topology).

Three verbs are gated, and the third is load-bearing. The first
implementation gated only `VERB_NETWORK_CONFIG` and
`VERB_NETWORK_CREDENTIALS` and still let the classical peer join at 0%
loss, because membership is granted by the *serve* direction: a classic
peer asks the pqconly node's controller for its config, and the node
enforcing the policy was the one handing it over. Gating
`VERB_NETWORK_CONFIG_REQUEST` before the controller is consulted closes
it. The rejection counter had been incrementing in the unrelated
direction throughout, which is what made the false assurance possible.

`hybrid` keeps its silent classical fallback - that is its contract - but
now logs a downgrade WARNING once per peer, re-armed on recovery, so a
downgraded link is no longer invisible.

The gate keys on `_hybridCapable`, not `hybridSessionKeyInstalled()`:
the encapsulating peer stages its hybrid key until the confirm tag
arrives, so gating on the installed key would reject a healthy PQ peer
for the entire staging window.

Measured 2026-10-08, two-host lab, clean rebuild, selftest exit 0:
- `pqconly` vs classical: network now sits at REQUESTING_CONFIGURATION
  with assignedAddresses [] and 100% loss, down from OK at 0% loss.
- `pqconly` vs `pqconly`: 0% loss both directions, no false rejection.
2026-10-08 10:33:12 +00:00
proitlab 975148525b docs: measure pqcMode pqconly; it does not enforce PQ
Tested pqconly on both lab hosts. It behaves identically to hybrid at
runtime and is NOT the "no classic fallback" policy mode its comment
claims.

Only one runtime site distinguishes the modes: identity generation
(Identity.cpp:109). Every handshake gate tests pqcMode() != CLASSIC
(Peer.hpp:434, Node.cpp:274), so hybrid and pqconly share a path. A
tree-wide grep finds no other PQCONLY reference in compiled code.

Measured against a genuinely classical peer (identity wiped, since the
identity is loaded from disk and off alone does not revert it):
pqconly reported capable=False hybrid=False paths=3 and forwarded
packets with 0% loss. It does not refuse a peer without PQ material and
emits no warning.

Consequence: a pqconly node gets no downgrade protection, and the only
detection is monitoring pqcHybridActive. Documented in
docs/pqconly-mode-test.md with the reproduction steps and the restore
procedure, cross-linked from the mode table in the main runbook.

Also fixes an od command in the runbook: identity.public is a
colon-delimited text file, so od reads ASCII rather than the type byte.
The type is field 2.

Lab restored to pqcMode hybrid, both hosts pqcHybridActive=true, 0% loss
in both directions.
2026-10-08 09:53:09 +00:00
proitlab 727e31b33d dissector: stop reporting ciphertext bytes as verb on encrypted frames
The dissector tested only the pre-1.0.3 0x80 "encrypted" bit, which a
modern AES-GCM packet never sets — the cipher suite lives in flags bits
3-5 (Packet.hpp:1319). Every AES-GCM frame therefore had byte 27 shown
as zt.verb, so a PQ capture produced a histogram of garbage (values up
to 254) that looked like protocol traffic and none of it was.

Cipher suite is now read from bits 3-5, zt.verb is only added on
unencrypted frames, and encrypted frames are labelled as such.

This also invalidates a claim in both docs: VERB_PQ_KEYS is armored with
encryptPayload=true (Peer.cpp:628), so its verb was never actually
readable. The earlier "zt.verb == 23 matches 1" result was ciphertext
that happened to equal 23. PQ_KEYS must be identified by size and
fragmentation (4257 B, ~13 fragments at 1480 B), which is what §7 now
says.

Verified on a live hybrid capture: verb histogram collapses to the
single real value 1, all 127 frames still match zt, the capability bit
and fragment headers still parse.

Adds docs §6.3 covering the data-channel question: the session key
cannot be read from the wire, but pqcHybridActive reports
Peer::hybridSessionKeyInstalled(), which does assert the installed key.
Confirmed true on both hosts.
2026-10-08 09:28:55 +00:00
proitlab bb1e5c20f1 docs: add two-host PQ manual runbook; correct HELLO/PQ_KEYS facts
build.yml / build_ubuntu (push) Canceled after 0s
build.yml / build_macos (push) Canceled after 0s
build.yml / build_windows (push) Canceled after 0s
Lint / clang-format (push) Canceled after 0s
validate.yml / build_ubuntu (push) Canceled after 0s
Add docs/two-host-pq-manual-test.md — the human-redo procedure for the
two-machine post-quantum test over real NICs, real TUN/TAP and systemd.
Every command was executed against both live hosts before being written
down; testing caught three errors in the draft (identity address
extraction, swapped ping directions, and the HELLO sizing claim below).

Correct docs/pqc-test-scenario.md, which still described the pre-fix
design: PQ material does NOT ride in HELLO. Peer.cpp:527 serializes only
the classic identity projection, so a hybrid HELLO is 185 B / 1 fragment
in both modes and the ML-KEM ciphertext arrives in a separate
VERB_PQ_KEYS frame. That is precisely why the controller compares classic
material (B6) and why a 6415 B identity would blow the fragment budget.
Confirmed on a live capture: 50 HELLOs with cap=1, 1 VERB_PQ_KEYS frame.

The 2.0.0 test matrix is kept but labelled historical, since its rationale
is still worth having.
2026-10-08 05:24:08 +00:00
30 changed files with 1427 additions and 40 deletions

No files matched your search

+29 -2
View File
@@ -1,2 +1,29 @@
.git/
workspace/
# Build outputs. The makefiles emit no -MMD dependency tracking, so shipping the
# checkout's prebuilt .o files into an image build can link an ABI-mismatched
# binary (symptom: SIGSEGV at Topology::Topology on startup). Never copy them.
.git
**/*.o
**/*.a
backone
backone-cli
backone-idtool
backone-selftest
# Arch-pinned vendored prebuilts (ubuntu22.04/amd64, ubuntu22.04/arm64).
# ZT_CONTROLLER_NO_SQL=1 must never link these; excluding them also keeps the
# build context from implying that the image is arch-locked.
ext/libpqxx-7.7.3/install
ext/hiredis-1.0.2/lib
ext/redis-plus-plus-1.3.3/install
rustybits/target
ext/redis-plus-plus-1.3.3/build
ext/hiredis-1.0.2/build
ext/libpqxx-7.7.3/build
# Docs and packaging that no image build reads.
docs
pkg
windows
java
rule-compiler/node_modules
+2 -1
View File
@@ -49,6 +49,7 @@ make selftest && ./backone-selftest
make debug # ZT_DEBUG=1 (adds -g, forces ZT_TRACE=1)
make ZT_SANITIZE=1 one # ASan
make central-controller # ZT_CONTROLLER=1 (needs ext/ libpqxx + hiredis + redis++)
make ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one # embedded controller on FileDB; strips libpqxx/libpq/hiredis/redis++/smeeclient (no cargo, no ext/ prebuilts) — see Dockerfile.controller
make install DESTDIR=/tmp/root
make debian | make redhat # debuild / rpmbuild
make manpages # cd doc && ./build.sh (needs ronn or node marked-man)
@@ -59,7 +60,7 @@ cd tcp-proxy && make
`Makefile` is a uname dispatcher → `make-linux.mk` / `make-mac.mk` / `make-bsd.mk` / `make-netbsd.mk`. Windows: `MSBuild windows/ZeroTierOne.sln /property:Configuration=Release`. Top-level `CMakeLists.txt` is a 323B stub — never `cmake .` as product build.
Env knobs (make vars): `ZT_DEBUG`, `ZT_TRACE`, `ZT_SANITIZE`, `ZT_STATIC`, `ZT_OFFICIAL`, `ZT_CONTROLLER`, `ZT_SSO_SUPPORTED` (0 on Linux default → no cargo needed), `ZT_VAULT_SUPPORT`, `ZT_IA32`.
Env knobs (make vars): `ZT_DEBUG`, `ZT_TRACE`, `ZT_SANITIZE`, `ZT_STATIC`, `ZT_OFFICIAL`, `ZT_CONTROLLER`, `ZT_CONTROLLER_NO_SQL` (opt-out from `ZT_CONTROLLER=1`'s SQL backends; additive, never redefines it), `ZT_SSO_SUPPORTED` (0 on Linux default → no cargo needed), `ZT_VAULT_SUPPORT`, `ZT_IA32`.
**Build hygiene — no header dependency tracking.** The makefiles emit no `-MMD` `.d` files, so `.o` outputs never rebuild when a header changes. A tree that ships prebuilt objects (root `one.o`, `node/*.o`, `libbackonecore.a` — present in this checkout) plus any `.hpp` edit produces ABI-mismatched objects; symptom is an instant `SIGSEGV` at `Topology::Topology` during `./backone` startup with a null call target. `make clean` after touching any `.hpp`, and verify startup after every build:
+61
View File
@@ -0,0 +1,61 @@
# vim: ft=dockerfile
#
# BackOne controller image: embedded controller on FileDB.
#
# ZT_CONTROLLER_NO_SQL=1 keeps PostgreSQL, Redis and the Rust smeeclient client
# out of the build entirely, so no libpq-dev, no cargo toolchain and no
# ext/*/install/ubuntu22.04/$(EXT_ARCH) prebuilts are needed -- any Debian base
# works. See SPEC.md V21/V22.
FROM debian:bookworm-slim AS builder
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
clang \
make \
libssl-dev \
pkg-config \
libminiupnpc-dev \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN make -j"$(nproc)" ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one
# V21: prove at build time that nothing from the SQL backends got in.
RUN ! nm -C backone | grep -qiE 'pqxx|PostgreSQL::|sw::redis|smeeclient'
FROM debian:bookworm-slim
# libminiupnpc is a hard runtime dependency (ldd backone -> libminiupnpc.so.21);
# openssl is required by the gate script's curl usage in CI images and left in
# for operators debugging the control plane. No libpq5, no rust.
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
libminiupnpc17 \
iproute2 \
curl && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/backone /usr/sbin/backone
RUN ln -sf /usr/sbin/backone /usr/sbin/backone-cli && \
ln -sf /usr/sbin/backone /usr/sbin/backone-idtool
ENV ZEROTIER_HOME=/var/lib/backone \
ZT_PID_FILE=backone.pid \
ZT_PORT_FILE=backone.port \
ZT_DAEMON=/usr/sbin/backone \
ZT_CLI=backone-cli
# identity.secret + controller.d live here: replacing the container must not
# change the node address or lose network state.
VOLUME ["/var/lib/backone"]
EXPOSE 9993
# -U skips the root check so the container need not run as uid 0, matching the
# spec's "no privilege drop". The daemon runs in the foreground as PID 1.
CMD ["/usr/sbin/backone", "-U", "-p9993"]
+34
View File
@@ -36,6 +36,40 @@ You can build this image like so:
docker build -f Dockerfile.release -t mybuild --build-arg VERSION=1.6.5 .
```
## The controller image (`Dockerfile.controller`)
`Dockerfile.controller` builds BackOne with the embedded network controller enabled and its default `FileDB` backend, with PostgreSQL, Redis and the Rust `smeeclient` library left out of the build entirely. That is what `ZT_CONTROLLER_NO_SQL=1` buys you: no `libpq-dev`, no cargo toolchain, and no `ext/*/install/ubuntu22.04/$(EXT_ARCH)` prebuilts, so the image builds on any Debian base instead of being pinned to the host distribution the vendored prebuilts were cut for.
```
sudo docker build -f Dockerfile.controller -t backone-controller .
sudo docker run -d --name backone-ctl \
--cap-add NET_ADMIN --device /dev/net/tun \
-v backone-ctl:/var/lib/backone \
--network host \
backone-controller /usr/sbin/backone -U -p9993
```
The controller is on by default; there is nothing to configure. Keep `/var/lib/backone` on a volume — it holds `identity.secret` and `controller.d/`, and replacing the container without it changes the node address and loses network state.
`--network host`, not `-p 9993:9993`. The API authorizes loopback source addresses only, unless `settings.allowManagementFrom` widens it (`service/OneService.cpp:1859`), and a published port arrives at the container after DNAT — from the bridge gateway, not loopback — so it answers `401` no matter how correct the token is. Drive the API from inside the container:
```
sudo docker exec backone-ctl sh -c \
'curl -sS -H "X-ZT1-Auth: $(cat /var/lib/backone/authtoken.secret)" http://127.0.0.1:9993/controller/network'
```
To reach the API from another host, bind it to the container's own port with `allowManagementFrom` set to the network you intend to allow, and then treat the token as a credential exposed to that network.
To verify an image rather than trust that it built, run the gate. It asserts the binary carries no PostgreSQL/Redis/smeeclient symbols and then drives a live network create → member authorize → member list → on-disk check through the controller, because a build with an unconfigured SQL backend compiles cleanly and fails only at runtime:
```
tools/controller-image-gate.sh # build the image, then gate it
tools/controller-image-gate.sh --local # gate ./backone without docker
tools/controller-image-gate.sh --image NAME --port N # gate an image already built
```
`make central-controller` and `ZT_CONTROLLER=1` on its own are unchanged: they still build with PostgreSQL and Redis available. `ZT_CONTROLLER_NO_SQL=1` is an opt-out from that, never a redefinition of it.
## Using the docker image
The `entrypoint.sh` in the docker image is a little different; zerotier will be spawned in the background and the "main process" is actually just a sleeping shell script. This allows `zerotier-one` to gracefully terminate in some situations largely unique to docker.
+69
View File
@@ -1,6 +1,75 @@
ZeroTier Release Notes
======
# 2026-12-04 -- Version 2.0.4
* Fix: a `pqcMode:hybrid` controller refused every pre-PQ (v1.x) client.
The controller always double-signed the certificate of membership, so it
serialized with type byte 2, and a v1 parser rejects any type != 1: the
whole network config was dropped and the client sat at
`REQUESTING_CONFIGURATION` forever, surfacing as `ACCESS_DENIED` once the
network was private.
The requester's PQ capability now rides in the `VERB_NETWORK_CONFIG_REQUEST`
metadata (`ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE`, bit 0 of the
previously-unused `f` key). A type-2 COM goes only to a requester that
advertised the bit; everyone else -- every legacy client, and push configs
that carry no request metadata -- gets type 1. No wire change for v1 peers
beyond the metadata key they already ignore.
* Verified on the lab: legacy v1.14.1 client `status:OK`,
`netconfRevision:5` against a `hybrid` controller (was
`REQUESTING_CONFIGURATION`, revision 0); a 2.0.3 hybrid client still comes
up `OK` and still receives type 2. selftest exit 0, no failures.
# 2026-10-08 -- Version 2.0.3
* Fix: `pqconly` enforced nothing. The mode selected a type-1 identity, then
every handshake gate tested only `pqcMode() != CLASSIC` -- identical to
`hybrid` -- so it distinguished nothing and refused no peer. A node in
`pqconly` carried traffic with a fully classical peer at 0% loss, with no
log line and no way to detect it except reading `pqcHybridActive`.
`pqconly` is now a policy. A non-capable, non-root peer is refused
`VERB_NETWORK_CONFIG`, `VERB_NETWORK_CREDENTIALS` and
`VERB_NETWORK_CONFIG_REQUEST`, each counted, with a one-time WARNING per
peer. PLANET/MOON are exempt: all four Earth roots report
`pqcCapable:false` and enforcing against them would cut the node off from
the root topology. Peering itself is still allowed -- what is refused is the
network coming up over a link that cannot be PQ-protected.
* Fix: the first version of that gate still let a classical peer join, because
membership is granted by the *serve* direction. A classic peer asks the
`pqconly` node's controller for its config, and the node enforcing the
policy was the one handing it over; the two receive-side gates could not see
it. The counter was incrementing in the unrelated direction the whole time,
which is what made the false assurance look like a pass.
* Add: `hybrid` keeps its silent classical fallback -- that is its contract --
but now logs a downgrade WARNING once per peer, re-armed on recovery, so a
downgraded link is no longer invisible.
* Add: `/peer` reports real `pqcCapable` / `pqcHybridActive` per peer, taken
from `Node::peers()` rather than copied from the `ZT_Peer` snapshot, which
never populated them and so always read `false`.
* The gate keys on `_hybridCapable`, not `hybridSessionKeyInstalled()`: the
encapsulating peer stages its hybrid key until the confirm tag arrives, so
gating on the installed key would reject a healthy PQ peer for the whole
staging window.
* Verified on a two-host lab, clean rebuild, selftest exit 0: `pqconly` versus
a classical peer now sits at `REQUESTING_CONFIGURATION` with no assigned
address and 100% loss (was `OK` at 0% loss); two `pqconly` nodes hold 0% loss
in both directions with no false rejection.
* Note: `_hybridCapable` is latched at HELLO and not cleared. A peer that
downgrades without restarting keeps its stale bit until its next HELLO. Not
currently exploitable -- capability is re-advertised every HELLO and the mode
only ever refuses non-capable peers -- but a peer that restarts into a
classical identity with the same home path will be refused until its
controller path is re-negotiated.
# 2026-10-07 -- Version 2.0.2
* Fix: post-quantum hybrid handshakes never completed. A peer's identity is
+22 -4
View File
@@ -16,9 +16,15 @@ Make BackOne quantum ready: phases 1-6 of `backone-quantum-fork-research.md` —
- 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` (intended ML-KEM-1024/ML-DSA-87 — not yet distinct, see T25)
- 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.*`)
@@ -37,9 +43,10 @@ Make BackOne quantum ready: phases 1-6 of `backone-quantum-fork-research.md` —
| 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. Per-algorithm `kem`/`sig` selection is *not* wired (research doc only, see T25) |
| 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)
@@ -67,6 +74,10 @@ Derived from `selftest.cpp` + CI gates. `?` = code-derived, no test yet.
| 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)
@@ -96,10 +107,13 @@ Derived from `selftest.cpp` + CI gates. `?` = code-derived, no test yet.
| 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` currently select identical material, while `SPEC` §C claims ML-KEM-1024/ML-DSA-87 for `pqconly`. Parameterize the preset (key sizes, ct len, `_pendingHybridCt` buffer) or drop the `pqconly` claim. The HELLO MTU objection recorded here 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 |
| 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`.
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.
@@ -113,3 +127,7 @@ Not tracked (low value `?`): `one.cpp:256` port/token cleanup, `MacKextEthernetT
| 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` |
+14 -1
View File
@@ -1,5 +1,5 @@
Name: backone
Version: 2.0.2
Version: 2.0.4
Release: 1%{?dist}
Summary: BackOne global ethernet switch
@@ -155,6 +155,19 @@ chmod 0755 $RPM_BUILD_ROOT/etc/init.d/backone
%endif
%changelog
* Fri Dec 4 2026 Dedy Sutanto <dsutanto@backone.cloud> - 2.0.4
- Fix: a pqcMode:hybrid controller refused every legacy client. COM was always
double-signed, so it serialized with type byte 2, and a pre-PQ parser rejects
any type != 1, dropping the whole network config. The requester's PQ
capability now rides in the network-config-request metadata and the
controller issues type 1 to a requester that did not advertise it.
See RELEASE-NOTES.md.
* Thu Oct 8 2026 Dedy Sutanto <dsutanto@backone.cloud> - 2.0.3
- pqconly now enforces a PQ-capable peer on member traffic, including on the
config-serve path. Previously it enforced nothing and behaved identically to
hybrid. See RELEASE-NOTES.md.
* Wed Oct 7 2026 Dedy Sutanto <dsutanto@backone.cloud> - 2.0.2
- see https://github.com/proitlab/BackOne for release notes
+6 -1
View File
@@ -2036,8 +2036,13 @@ void EmbeddedNetworkController::_request(
nc->certificateOfOwnershipCount = 1;
}
// A requester that did not advertise PQ capability cannot parse COM type 2
// (its COM parser rejects any type byte != 1 and drops the whole netconf, so
// it never leaves REQUESTING_CONFIGURATION and ends at ACCESS_DENIED).
// Issue it a classic type-1 COM instead.
const bool requesterPQCapable = ((metaData.getUI(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS,0) & ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE) != 0);
CertificateOfMembership com(now,credentialtmd,nwid,identity);
if (com.sign(_signingId)) {
if (com.sign(_signingId,requesterPQCapable)) {
nc->com = com;
} else {
_sender->ncSendError(nwid,requestPacketId,identity.address(),NetworkController::NC_ERROR_INTERNAL_SERVER_ERROR, nullptr, 0);
+19
View File
@@ -1,3 +1,22 @@
backone (2.0.4) unstable; urgency=medium
* Fix: a pqcMode:hybrid controller refused every legacy client. COM was
always double-signed, so it serialized with type byte 2, and a pre-PQ parser
rejects any type != 1, dropping the whole network config. The requester's PQ
capability now rides in the network-config-request metadata and the
controller issues type 1 to a requester that did not advertise it. See
RELEASE-NOTES.md.
-- Dedy Sutanto <dsutanto@backone.cloud> Fri, 04 Dec 2026 00:00:00 +0700
backone (2.0.3) unstable; urgency=medium
* pqconly now enforces a PQ-capable peer on member traffic, including on the
config-serve path. Previously it enforced nothing and behaved identically
to hybrid. See RELEASE-NOTES.md.
-- Dedy Sutanto <dsutanto@backone.cloud> Thu, 08 Oct 2026 00:00:00 +0700
backone (2.0.2) unstable; urgency=medium
* See RELEASE-NOTES.md for release notes.
+34 -20
View File
@@ -18,15 +18,17 @@ absent/unknown `settings.pqcMode` resolves to classic (`ZT_PQC_MODE_CLASSIC`),
so an upgraded type-0 install boots unchanged and keeps its address — see the
`B2` fix in `SPEC.md` §B. Verified live on a 2.0.0 build: no config → 141 B
type-0 identity; `"hybrid"` → 6415 B type-1 identity; classic identity +
`"hybrid"` refuses to start. Re-run §4/§5 to confirm the 1088 B ML-KEM
ciphertext and a hybrid `_key` on the wire. The table below is the original
2.0.0 diagnosis, kept for the rationale and the exact evidence.
`"hybrid"` refuses to start. The 1088 B ML-KEM ciphertext rides in
`VERB_PQ_KEYS`, **not** in HELLO — HELLO stays 185 B / 1 fragment in both modes
because it carries only the classic identity projection. For the current
end-to-end procedure see `two-host-pq-manual-test.md`. The table below is the
original 2.0.0 diagnosis, kept for the rationale and the exact evidence.
| # | Gap | Evidence | Symptom in the lab |
|---|---|---|---|
| G1 | Daemon never generates a type-1 identity. `Node.cpp:96` calls `RR->identity.generate()` with default `pq=false`, and `applyLocalConfig()` (which sets the mode) runs *after* `new Node(...)` (`OneService.cpp:1058` then `1062`). | **Fixed (T24 + B2):** `OneService` reads `local.conf` before `new Node` and passes `pqcMode`; `Identity::generate` takes it. Absent config is now classic, not hybrid. `node/Node.cpp:96`, `node/Identity.cpp:84-123`, `service/OneService.cpp` `_pqcModeFromLocalConfig`. | `"pqcMode":"hybrid"` now writes type byte `1`; measured `identity.public` = 6415 B vs 141 B classic (the old doc estimate of ~4230 B was the research-doc approximation) |
| G2 | Wire key agreement never used PQ. `myIdentity.agree(peerIdentity,…)` is plain C25519 (`Identity.hpp:343-350`). | **Fixed (B1):** production now calls `agreeHybridEncaps`/`agreeHybridDecaps` — `node/Peer.cpp:113` (encaps on first capability sighting) and `node/IncomingPacket.cpp:538,700` (decaps on HELLO and OK(HELLO)); `setHybridSessionKey` replaces the classical key. | Session key is hybrid when both peers advertise the capability; a vanilla peer still falls back to classical |
| G3 | Capability was advertised but never consumed: `Peer::_key` was derived in the constructor before any HELLO arrived, so the hybrid path was dead. | **Fixed (B1):** `Peer::hybridEligible()` now gates `_hybridCapable` (set in `setRemoteVersion`), the KEM ct rides in HELLO/OK(HELLO), and `setHybridSessionKey()` replaces the session key. `Peer::pqcCapability()` was removed as redundant. | Capture now shows a 1088 B ct after the capability bit |
| G3 | Capability was advertised but never consumed: `Peer::_key` was derived in the constructor before any HELLO arrived, so the hybrid path was dead. | **Fixed (B1):** `Peer::hybridEligible()` now gates `_hybridCapable` (set in `setRemoteVersion`), and `setHybridSessionKey` replaces the session key. `Peer::pqcCapability()` was removed as redundant. The KEM ct does **not** ride in HELLO — it was later moved to `VERB_PQ_KEYS` (`Peer.cpp:582`). | Capture shows `zt.hello.cap=1` plus a `VERB_PQ_KEYS` frame carrying the 1088 B ct |
Consequence: **the only end-to-end proof so far is `backone-selftest`** (ML-KEM KAT,
ML-DSA KAT, hybrid KDF vector, identity-v2 roundtrip, COM double-sign, HELLO
@@ -42,7 +44,9 @@ make selftest && ./backone-selftest # exit 0
[PQ] ML-DSA KAT (verify fixed pk/msg/sig; tamper fails)... PASS
[PQ] Hybrid KDF known-answer vector... PASS
[PQ] Interop hybrid<->vanilla matrix... PASS
size classic=137B/1 frag, PQC=3273B/3 frag (max 7)
size classic=137B/1 frag, PQC=137B/1 frag (max 7)
VERB_PQ_KEYS=4253B/3 frag
PQ mode adds no bytes to HELLO; PQ_KEYS fragments within budget
```
`backone-cli info -j` → `"version":"2.0.0"`. Lab daemons answered on
@@ -244,6 +248,13 @@ bug — see §4.5 trigger.
### 4.4 Test matrix
> **Historical — this table describes the 2.0.0 design and is kept for
> rationale.** It predicted a large, fragmented PQ HELLO. That is **not** what
> ships: the implemented design moved PQ material out of HELLO into
> `VERB_PQ_KEYS` precisely so HELLO stays small. Confirmed 2026-10-07 on a live
> hybrid↔hybrid link — `HELLO type=0 … cap=1`, 185 B, single fragment, plus a
> separate 1432 B `VERB_PQ_KEYS` frame. For current behavior and the correct
> assertions see `two-host-pq-manual-test.md` §6–§7.
| # | n1 mode | n2 mode | Expect today (2.0.0) | Expect after §7 fix | Observable |
|---|---|---|---|---|---|
| M1 | off | off | HELLO 137 B / 1 frag, cap=0, session classic | same | `zt.hello.cap==0`, 1 frag |
@@ -257,10 +268,9 @@ bug — see §4.5 trigger.
"after §7 fix" column is the live one: M3/M4 put large ML-KEM datagrams on
the wire (68 / 90 frames > 1200 B), no fragment failure observed.
M4 is the interesting negative: ML-KEM-1024 ct = 1568 B and ML-DSA-87 pk = 2592 B
(`[INFERENCE]` on exact liboqs sizes — confirm against `node/PQHybrid.hpp`
constants) push a `pqconly` HELLO to ~8 KiB, past the reassembly ceiling. Assert
the graceful failure, whichever behavior the fix chooses.
The M4 concern no longer applies: because PQ material moved to `VERB_PQ_KEYS`,
neither `hybrid` nor `pqconly` inflates HELLO. `pqconly` is a policy mode
(capability required, no classical fallback), not a larger packet.
### 4.5 Negative — tamper the handshake
@@ -365,16 +375,18 @@ would produce a *different observable*:
| Observable | Classical | Hybrid | Decidable? |
|---|---|---|---|
| HELLO size / fragment count | 137 B / 1 | 3273 B / 3 | yes |
| HELLO size / fragment count | 137 B / 1 | 137 B / 1 — **unchanged** | no — HELLO carries the classic projection only |
| HELLO capability bit | 0 | 1 | yes |
| ML-KEM ciphertext bytes on wire | none | 1088 B | yes, **only after §7** |
| `VERB_PQ_KEYS` exchange on wire | none | ~13 fragments of one 4257 B packet | yes — but **encrypted**: match on size/fragmentation, not `zt.verb` |
| Identity type byte | 0 | 1 | yes |
| COM type byte | 1 | 2 | yes |
| `_key` value | n/a off-wire | n/a off-wire | **no** — must be inferred from the above |
| Session key actually installed | `false` | `true` (`pqcHybridActive`) | yes — the only data-channel assertion |
Nothing about the negotiated symmetric key is directly observable. A test that
only does "ping works" passes trivially under M2 (classical fallback) and must not
be counted.
The session key is not readable from the wire — data frames are armored, so no
filter can reveal it. But its *installation* is directly observable via
`pqcHybridActive` (`Peer::hybridSessionKeyInstalled()`), which is a real
data-channel assertion. A test that only does "ping works" still passes trivially
under M2 (classical fallback) and must not be counted.
---
@@ -431,11 +443,13 @@ registration that ignored the lab port.)
tshark -X lua_script:tools/zt-dissector.lua -r /tmp/pqc.pcap -Y 'zt.verb == 1'
```
Verified against a synthetic capture (tshark 4.6.4): classic HELLO decodes as
`type=0`, 39 B identity; a fragmented hybrid HELLO's head fragment decodes as
`type=1`, 3175 B identity, `zt.hello.cap == 1`, and its tail frames as
`BackOne fragment n/3`. Run tshark as your normal user — as superuser Wireshark
silently skips user Lua scripts (see §4.3).
Verified 2026-10-07 against a **live** hybrid↔hybrid capture (tshark 4.6.4):
`zt` matches 167 frames, `zt.verb == 1` matches 50 HELLOs, `zt.hello.cap`
matches 50, and `zt.verb == 23` (`VERB_PQ_KEYS`) matches 1. A hybrid HELLO
decodes as `ZT HELLO type=0 <addr> cap=1` — 185 B, single fragment — because
HELLO carries only the classic projection; the PQ keys arrive in a separate
1432 B `VERB_PQ_KEYS` frame. Run tshark as your normal user — as superuser
Wireshark silently skips user Lua scripts (see §4.3).
---
+240
View File
@@ -0,0 +1,240 @@
# `pqcMode: pqconly` — manual test and measured result
Companion to [`two-host-pq-manual-test.md`](./two-host-pq-manual-test.md). That
document covers `hybrid`; this one covers `pqconly`, records the defect that
motivated it, and documents the enforcement that now backs the name.
**Status as of 2026-10-08.** `pqconly` used to be a synonym for `hybrid` — it
selected a type-1 identity and then enforced nothing, forwarding traffic to a
fully classical peer at 0% loss with no warning. That is measured and preserved
below in §2. `pqconly` now **enforces** the peer requirement (§3): under
`pqconly`, a network will not come up over a link that silently fell back to
classical.
---
## 1. What the mode is supposed to mean
Three values are accepted (`service/OneService.cpp:1436-1443`):
| `pqcMode` | Identity generated | Intended meaning |
|---|---|---|
| `off` | type 0, 141 B | classical |
| `hybrid` | type 1, 6415 B | use PQ when the peer supports it, else fall back |
| `pqconly` | type 1, 6415 B | **PQ required, no classical fallback** |
Before the fix, `Identity.hpp:4` carried the claim *"pqconly: PQ-only identities,
no classic fallback"* — which was false. The comment has since been corrected.
## 2. The defect: `pqconly` enforced nothing
*Measured 2026-10-08, before the fix.* `pqconly` selected a type-1 identity and
then behaved exactly like `hybrid`. The only runtime site distinguishing the
modes was identity generation:
```c
// node/Identity.cpp:105-110
if (pqcMode == ZT_PQC_MODE_CLASSIC) { pq = false; }
else if (pqcMode == ZT_PQC_MODE_PQCONLY) { pq = true; }
```
After that, every handshake gate tested only `!= CLASSIC`, so the two modes were
indistinguishable:
| Site | Test |
|---|---|
| `node/Peer.hpp:434` `hybridEligible()` | `pqcMode() != ZT_PQC_MODE_CLASSIC` |
| `node/Node.cpp:274` | `pqcMode() != ZT_PQC_MODE_CLASSIC` |
| `node/IncomingPacket.cpp:680` | no mode test — only `hybridCapable()` |
A full-tree grep found no other `ZT_PQC_MODE_PQCONLY` reference in compiled code.
Nothing rejected a non-capable peer, and nothing logged anything.
## 3. Reproducing the test
### 3a. Both hosts on `pqconly`
```sh
# HOST1 (controller)
/etc/backone/local.conf -> or /var/lib/backone/local.conf on this lab
{
"settings": {
"pqcMode": "pqconly"
}
}
```
```json
// HOST2 (member)
{
"settings": {
"pqcMode": "pqconly",
"disableController": true
}
}
```
```sh
sudo systemctl restart backone
ssh 192.168.122.85 'sudo systemctl restart backone'
```
Expect — identical to the `hybrid` run in every field:
```
HOST1 6415 bytes dbfa939d58 capable=True hybrid=True
HOST2 6415 bytes f4a1ff9427 capable=True hybrid=True
```
`pqcHybridActive: true` on both sides. Identical to the `hybrid` run — both
modes agree a PQ peer, and neither is distinguished by that fact.
### 3b. The decisive test — `pqconly` against a genuinely classical peer
Setting `pqcMode: off` is **not** enough: the identity is loaded from disk when
present, so the type-1 identity survives the change (`node/Node.cpp:96-107`
generates only when no identity exists). You must wipe it.
```sh
# HOST2: become a real type-0 peer
ssh 192.168.122.85 'sudo systemctl stop backone
sudo rm -f /var/lib/backone/identity.secret /var/lib/backone/identity.public
sudo systemctl start backone
sleep 8
cut -d: -f1 /var/lib/backone/identity.public # -> e17bdf70bb
stat -c%s /var/lib/backone/identity.public # -> 141 (type 0)'
```
Authorize the new address on HOST1 and join, per §5b/§5c of the main document.
The table below is what the *current* build does. **The "after enforcement" column
is the load-bearing part of this document — it is a design claim that measurement
repeatedly contradicted before it was enforced on both sides.** See §4a.
| | measured, before the fix | required after the fix |
|---|---|---|
| `paths` to the classical peer | 3 | 3 (handshake still completes) |
| `pqcHybridActive` | false | false |
| ping HOST1 → HOST2 | **0% loss** | times out, no reply |
| network status on HOST2 | OK | never reaches OK |
| daemon log on HOST1 | silent | `WARNING: … REFUSED` |
| `pkt_network_config_in_pqconly_rejected` | n/a | increments |
Paths remain because the handshake itself is still allowed — enforcement is
scoped to *network membership*, not to peering. Refusing to peer at all would
take the node off the root topology, since all four Earth roots are
`pqcCapable:false`.
## 4a. The serve-side hole (why the first fix did not work)
The first implementation gated only what this node *receives*:
- `_doNETWORK_CONFIG` — refuse an inbound config from a downgraded peer,
- `_doNETWORK_CREDENTIALS` — refuse inbound credentials.
Measured against `pqconly` HOST1 and a classical HOST2 with the network cache
deleted first, the network still came up: `10.97.0.77`, status `OK`, ping
**0% loss**. The rejection counter incremented (credentials, in the *other*
direction) while traffic flowed anyway.
The reason is that membership is granted by the *serve* direction. A classic peer
sends `VERB_NETWORK_CONFIG_REQUEST` to the node running the controller, and that
node — the one actually in `pqconly` — answered from
`RR->localNetworkController` with no check at all. The node enforcing the policy
never guarded the path that hands out the config. Refusing inbound packets only
stops a downgraded peer from pushing a network at us; it does nothing about us
handing one to them.
The fix adds the same gate at `_doNETWORK_CONFIG_REQUEST` before the controller
is consulted. Three verbs are now refused, not two:
| verb | direction | effect |
|---|---|---|
| `VERB_NETWORK_CONFIG` | in | downgraded peer cannot push a network at us |
| `VERB_NETWORK_CREDENTIALS` | in | a COM cannot establish trust over a classical link |
| `VERB_NETWORK_CONFIG_REQUEST` | in, gates our **serve** | we do not hand config to a peer we know cannot do PQ |
## 4b. The rule itself
`Peer::pqconlyPeerRejected()` returns true only when **all** of these hold:
1. this node's mode is exactly `ZT_PQC_MODE_PQCONLY` — `hybrid` never rejects,
2. the peer did **not** advertise the capability bit in its HELLO revision,
3. the peer's role is **not** PLANET or MOON.
Two design points worth knowing before you change it:
- **The gate keys on `_hybridCapable`, not on `hybridSessionKeyInstalled()`.**
Capability is fixed once at HELLO. The hybrid *key* is not: the encapsulating
peer derives it before the other side has even seen the ciphertext, and holds it
staged until the confirm tag arrives. Gating on the installed key would reject
a perfectly good PQ peer for the entire staging window.
- **PLANET/MOON are exempt.** All four Earth roots report `pqcCapable:false` and
never will; enforcing against them would sever world/world routing.
Refused: `VERB_NETWORK_CONFIG`, `VERB_NETWORK_CREDENTIALS` and
`VERB_NETWORK_CONFIG_REQUEST` (`node/IncomingPacket.cpp`). The first two are
receive-side; the third is the serve-side gate that actually stops membership
(§4a). Credentials matter most among the receive-side pair — a COM is what
establishes trust for a network, so admitting one over a classical link would
reinstate the downgrade the mode exists to prevent.
## 5. The `hybrid` downgrade warning
`hybrid` still falls back to classical — that is its contract — but no longer
silently. When a non-classic-mode node sees a network arriving from a peer that
cannot do PQ, `Node::setPQCDowngradeWarning()` logs once per peer:
```
WARNING: peer e17bdf70bb cannot do post-quantum key exchange but this node is in
pqcMode hybrid; traffic to it is classical.
```
It warns on *entry* to the downgraded state and again on recovery (an `INFO`
line), so a peer that flaps stays visible without one line per packet. `hybrid`
keeps forwarding the traffic — the warning is the signal, not a refusal.
Monitoring notes, if you alert on this: PLANET peers are permanently
non-capable, and there is a window before any handshake completes, so exclude
`role == "PLANET"` and allow a grace period or you will page on normal operation.
## 6. Restoring the lab afterwards
Wiping HOST2's identity destroys it permanently — only `identity.secret` is kept
and there is no backup copy. The address changes and must be re-authorized.
```sh
# restore config
sudo cp /var/lib/backone/local.conf.bak-hybrid /var/lib/backone/local.conf
ssh 192.168.122.85 'sudo cp /tmp/pqconly.conf /var/lib/backone/local.conf'
# regenerate a type-1 identity and re-enroll
ssh 192.168.122.85 'sudo systemctl stop backone
sudo rm -f /var/lib/backone/identity.secret /var/lib/backone/identity.public
sudo systemctl start backone; sleep 8
cut -d: -f1 /var/lib/backone/identity.public' # new address
# on HOST1, authorize the new address, then join from HOST2
curl -s -X POST -H "X-ZT1-Auth: $A" -H 'Content-Type: application/json' \
-d '{"authorized":true}' \
http://127.0.0.1:9993/controller/network/$NWID/member/<new-addr>
ssh 192.168.122.85 "/usr/sbin/backone-cli -p9993 -D/var/lib/backone join $NWID"
```
Verify:
```sh
curl -s -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/peer | python3 -c "
import json,sys
for p in json.load(sys.stdin):
if p.get('role')!='PLANET': print(p['address'],'hybrid=',p.get('pqcHybridActive'))"
```
Expect `hybrid=True` and 0% loss in both directions.
## 7. Caveat on the measured addresses
Addresses in this document are from the 2026-10-08 run. Re-running regenerates
identities, so read the current values rather than copying these.
+511
View File
@@ -0,0 +1,511 @@
# Two-Host Post-Quantum Test — Manual Runbook
Human-redo of the two-machine BackOne PQ test. For *this* host + `192.168.122.85`
over real NICs, real TUN/TAP, and systemd. The hermetic netns lab lives in
[`pqc-test-scenario.md`](./pqc-test-scenario.md) §4–§5 (`tools/pqc-lab.sh`) and is
**not** repeated here — it proves the handshake on synthetic interfaces; this
doc proves it end to end on real machines, and adds the **membership** half that
the netns lab never exercised.
Verified live 2026-10-07 on BackOne 2.0.2. Every command below was run as written.
---
## 0. Roles and the one rule that makes this work
| Host | Address | Role | `local.conf` settings |
|---|---|---|---|
| **HOST1** | this machine (192.168.122.x) | **controller** — owns the network | `{"settings":{"pqcMode":"hybrid"}}` |
| **HOST2** | `192.168.122.85` | **member** — joins HOST1's network | `{"settings":{"pqcMode":"hybrid","disableController":true}}` |
**The rule: exactly one host runs a controller.** Setting `disableController: true`
on HOST2 is not optional. Without it, both nodes answer their own
`NETWORK_CONFIG_REQUEST`s and self-sign a local config, so they never contact each
other and you get `ACCESS_DENIED` with an empty peer list — a symptom
*indistinguishable* from the B6 bug. See §7.
`disableController` defaults to **false**, so a fresh install still runs a
controller. That default is why this step is easy to miss.
---
## 1. Prerequisites
Both hosts need:
- BackOne built at **2.0.2 or later** (the three fixes in §7 are required).
- `curl`, `python3` (for the JSON checks), `ping`.
- ROOT: `tshark` for dissection, `tcpdump` for capture.
- Network: HOST1 and HOST2 must reach each other on **UDP 9993** directly.
Verify first — if UDP is blocked, you will be debugging a relay path instead
of PQ:
```sh
# run on HOST1, HOST2's IP substituted
nc -zu -w2 192.168.122.85 9993 # or: ping -c2 192.168.122.85
```
Confirm the UDP path exists before starting. §4's absolute gate requires a
`DIRECT` path.
---
## 2. Step 0 — confirm which binary each host runs
Do this **before** anything else. A repo build and a root-installed
`/usr/sbin/backone` are different binaries, and "the fix didn't work" is almost
always this mismatch.
```sh
# on each host
/usr/sbin/backone -v # installed package build
./backone -v # repo build, if run from a source tree
sudo -n ls -la /var/lib/backone/backone # symlink → which binary the service uses
systemctl status backone --no-pager | head -20
```
Record for each host: version string, and whether the service runs the package
binary or a repo build. The live test used a **repo build** deployed over the
system install.
> If you change the binary, `systemctl restart backone`. A stale running process
> keeps the old code in memory regardless of what is on disk.
---
## 3. Reset state (destructive, per run)
This wipes **identity** and **network membership** on both hosts:
```sh
# on EACH host
sudo systemctl stop backone
sudo rm -f /var/lib/backone/identity.secret \
/var/lib/backone/identity.public \
/var/lib/backone/identity.public.bak \
/var/lib/backone/identity.secret.bak
sudo rm -rf /var/lib/backone/networks.d
sudo systemctl start backone
```
**`controller.db` is deliberately kept.** It holds the network definition and the
member roster; wiping it would throw away the network you are about to test.
**But kept ≠ untouched.** After an identity wipe, every member row still carries
the *old* address. The controller compares the new identity against that stale
row and denies access — the B6 failure mode. §5 re-enrolls every member, which
is what clears the stale field. Skipping re-enrollment is the single most
common reason a redo fails.
> BackOne regenerates a fresh identity on next start. Its address (and identity
> size) depends on `pqcMode` — see §4.
---
## 4. Configure the mode and verify the identity
`local.conf` lives at `/var/lib/backone/local.conf`. Write it **before** starting
the daemon — the mode is read at startup.
**HOST1 (controller):**
```json
{
"settings": {
"pqcMode": "hybrid"
}
}
```
**HOST2 (member):**
```json
{
"settings": {
"pqcMode": "hybrid",
"disableController": true
}
}
```
Restart and verify the identity type — this is the first and cheapest check:
```sh
sudo systemctl restart backone
stat -c '%s' /var/lib/backone/identity.public
```
| `pqcMode` | identity size | first byte |
|---|---|---|
| absent / `off` | **141 B** | `0` (classic) |
| `hybrid` | **6415 B** | `1` (type 1, PQ) |
| `pqconly` | 6415 B | `1` — **enforces** PQ on network membership, see below |
> **`hybrid` vs `pqconly`.** Both write the same PQ material and both reach
> `pqcHybridActive: true` against a PQ peer. They differ only in what happens to a
> peer that *cannot* do PQ: `hybrid` falls back to classical and logs a one-time
> `WARNING`; `pqconly` refuses that peer's network config and credentials, so the
> network never comes up over an unprotected link (PLANET/MOON roots are exempt —
> they are `pqcCapable:false` and always will be). `pqconly` was previously
> indistinguishable from `hybrid` and enforced nothing; see
> [`pqconly-mode-test.md`](./pqconly-mode-test.md) for the measurement and the
> reproduction steps.
`identity.public` is a colon-delimited text file (`address:type:flags:...`), so
`od` on it reads ASCII, not the type byte. Field 2 is the type:
```sh
cut -d: -f2 /var/lib/backone/identity.public # expect 1 under hybrid
/usr/sbin/backone-idtool validate /var/lib/backone/identity.public
```
If a classic 141 B identity is present while `pqcMode: hybrid` is configured, the
daemon **refuses to start** by design (classic↔PQ mismatch). Wipe per §3 and
restart.
---
## 5. Create the network and enroll HOST2 (on HOST1)
HOST1 is the controller, so all controller API calls happen here.
```sh
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
```
### 5a. Create the network
```sh
curl -s -X POST -H "X-ZT1-Auth: $A" -H 'Content-Type: application/json' \
-d '{"name":"pq-manual","private":true,"ipAssignmentPools":[{"ipRangeStart":"10.97.0.1","ipRangeEnd":"10.97.0.254"}]}' \
http://127.0.0.1:9993/controller/network | python3 -m json.tool
```
Write down the `id` (the nwid). It is used in every call below.
### 5b. Authorize HOST2's identity
Read HOST2's address over SSH — it changed when you wiped the identity in §3.
`identity.public` is a **colon-delimited text file**, field 1 being the address
(`address:revision:flags:privkey:pubkey...`), not a binary blob. Extract with
`cut`, never with a byte offset:
```sh
HOST2_ADDR=$(ssh 192.168.122.85 "cut -d: -f1 /var/lib/backone/identity.public")
echo "$HOST2_ADDR" # 10 hex chars
```
Cross-check against the authoritative source, which derives the address from the
private key rather than reading the cached public file:
```sh
ssh 192.168.122.85 "sudo -n /usr/sbin/backone-idtool getpublic /var/lib/backone/identity.secret | cut -d: -f1"
```
Then authorize it. `authorized: true` is the field the API reads
(`EmbeddedNetworkController.cpp:1175`):
```sh
NWID=<paste-nwid-here>
curl -s -X POST -H "X-ZT1-Auth: $A" -H 'Content-Type: application/json' \
-d '{"authorized":true}' \
http://127.0.0.1:9993/controller/network/$NWID/member/$HOST2_ADDR
```
Repeat §5b for **every** member you wiped in §3 — including HOST2 in the
classical run below.
### 5c. Have HOST2 join
```sh
ssh 192.168.122.85 "/usr/sbin/backone-cli -p9993 -D/var/lib/backone join $NWID"
```
Expected: `200 join OK` (again — the leading number is an HTTP status, not a
count).
---
## 6. Assertions
Two layers, both required. §6.1 is the pass/fail gate; §6.2 is what actually
proves PQ.
### 6.1 Absolute gate — does the network work at all?
```sh
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
curl -s -m 8 -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/network/$NWID \
| python3 -c "import json,sys; d=json.load(sys.stdin); print('status:',d.get('status'),'peers:',len(d.get('peers',[])))"
```
| Observable | Required |
|---|---|
| `status` | `OK` — **not** `ACCESS_DENIED` |
| `peers` | non-empty |
| peer role / path | `LEAF` / `DIRECT`, address `192.168.122.85/9993` |
```sh
/usr/sbin/backone-cli -p9993 -D/var/lib/backone peers
```
> The first line reads `200 peers`. That is the **HTTP status code**, not a peer
> count — a very common misreading. The real table is printed beneath it.
Data plane, both directions. Read each host's assigned address first — the IPs
below are from the verified 2.0.2 run, and a re-created network assigns new ones:
```sh
# on HOST1 (assigned 10.97.0.13) → ping HOST2 (assigned 10.97.0.52)
ping -c 5 -W 3 10.97.0.52
# on HOST2 → ping HOST1
ssh 192.168.122.85 'ping -c 5 -W 3 10.97.0.13'
```
Both must report **0% packet loss**. Do not assume the addresses — query them:
```sh
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
curl -s -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/network/$NWID \
| python3 -c "import json,sys; d=json.load(sys.stdin); print(d['id'], d['status'], d.get('assignedAddresses'))"
```
### 6.2 Comparative gate — is PQ genuinely active?
Run the same checks in both modes and compare. An absolute check alone proves
nothing about PQ: `status: OK` and `0% loss` pass identically on a build with all
PQ code deleted.
```sh
# per peer, on each host
curl -s -m 8 -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/peer | python3 -c "
import json,sys
for p in json.load(sys.stdin):
if p.get('role') != 'PLANET':
print(p['address'], 'capable=', p.get('pqcCapable'), 'hybrid=', p.get('pqcHybridActive'))"
```
| Observable | classical (`off`) | hybrid — **must differ** |
|---|---|---|
| `identity.public` size | 141 B | **6415 B** |
| identity type byte | `0` | **`1`** |
| `pqcCapable` | `false` | **`true`** |
| `pqcHybridActive` | `false` | **`true`** |
| `zt.hello.cap` | 0 | **1** |
| `zt.hello.idtype` in HELLO | `0` | **`0` — see note** |
| `VERB_PQ_KEYS` frames on wire | absent | **present** |
| HELLO size / fragments | 185 B / 1 | **185 B / 1 — unchanged** |
> **HELLO does not grow in PQ mode, and that is correct.** HELLO carries only the
> *classic* projection of the identity (`Peer.cpp:527` calls
> `Identity::serializeClassic`), deliberately: a type-1 identity is 6415 B and
> would blow the fragment budget, which is also why the controller must compare
> classic material (the B6 fix). The capability bit in the HELLO revision field
> and the PQ keys in `VERB_PQ_KEYS` are what signal hybrid. Do **not** expect a
> large or fragmented HELLO — if you see one, something else is wrong.
>
> The *identity file* is 6415 B because it holds the full type-1 record
> (ML-KEM-768 + ML-DSA-65 public keys); the *HELLO packet* is not.
### 6.3 Data-channel gate — proving the *data* key is PQ-derived
§6.2 proves the handshake advertises and exchanges PQ material. It does **not**
prove the session key protecting your frames came from it. Those are different
claims, and the gap matters: `pqcHybridActive` is the closest thing to a direct
answer, but read what it actually reports.
```sh
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
curl -s -m 8 -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/peer | python3 -c "
import json,sys
for p in json.load(sys.stdin):
if p.get('role') != 'PLANET':
print(p['address'], 'capable=', p.get('pqcCapable'), 'hybrid=', p.get('pqcHybridActive'))"
```
| Field | What it actually means |
|---|---|
| `pqcCapable` | Peer set the capability bit. Advertised support only. |
| `pqcHybridActive` | `Peer::hybridSessionKeyInstalled()` — the derived key is **installed into `_key`**, the buffer every data frame is armored with. |
`pqcHybridActive: true` is a genuine assertion about the data channel, and it is
deliberately stricter than "eligible": the code comment at `node/Peer.hpp:710`
says eligibility "is true a full round trip before the key exists, so reporting
it as 'hybrid active' claims protection that is not in use."
**Why tcpdump/tshark cannot answer this directly.** Data frames are armored with
the session key (`Peer.cpp:645`), so the payload — and the verb byte — is
ciphertext. No filter can distinguish a PQ-derived key from a classical one,
because that property is not visible in the output of a cipher. Any "the data
frames look post-quantum" check is vacuous.
**The one wire artifact that does bear on it.** `Peer::pqConfirmTag`
(`node/Peer.hpp:67`) is `HMAC-SHA384(installed session key, min(addr) ‖
max(addr))` truncated to `ZT_PQ_KEYS_CONFIRM_LEN` = 4 bytes, appended **last**
in `VERB_PQ_KEYS` so its position is unambiguous. Recomputing it offline under a
candidate key and comparing proves which key both peers derived — but it is a
verifier requiring the session key, not a passive observation, so it must be
run on one of the hosts. Treat it as a lab tool for the key-confirmation path
(`IncomingPacket.cpp:1613`), not as a routine capture check.
---
## 7. Capture and dissection
Capture on **HOST1**, `udp port 9993`:
```sh
sudo tcpdump -i any -s 0 -w /tmp/pq.pcap 'udp port 9993' &
CAP=$!
```
Reproduce the handshake (restart HOST2's service to force a fresh HELLO), then:
```sh
kill $CAP
```
Dissect with the repo dissector (`tools/zt-dissector.lua`):
```sh
tshark -X lua_script:tools/zt-dissector.lua -r /tmp/pq.pcap \
-Y 'zt.verb == 1' # VERB_HELLO (Packet.hpp:617)
```
| Filter | Shows |
|---|---|
| `zt` | any BackOne frame |
| `zt.verb` | **only on unencrypted frames** — absent on encrypted ones |
| `zt.verb == 1` | HELLO only (`Packet.hpp:617`) |
| `zt.hello.cap` | capability bit — `0` classical, `1` hybrid |
| `zt.hello.idtype` | identity type **in HELLO** — `0` even in hybrid (classic projection only) |
| `zt.hello.idsize` | serialized classic identity size (39 B) |
| `zt.flags` | cipher suite in bits 3-5; `0x80` is the pre-1.0.3 legacy bit |
| `zt.frag` / `zt.fragno` / `zt.fragtot` | fragment header — only for large frames |
**Verified live 2026-10-07** on a hybrid↔hybrid link:
```
ZT HELLO type=0 DBFA939D58 cap=1 185 B # unencrypted, cap bit set
ZT ... Len=1480 flags=0x58 # PQ_KEYS fragments, cipher 3 (AES-GCM)
```
> **`VERB_PQ_KEYS` is encrypted and its verb is NOT visible.** It is armored
> with the *classical* key and `encryptPayload=true` (`Peer.cpp:628`), so byte 27
> is ciphertext like any other data packet — that is what lets the peer read it
> before it has switched to the hybrid session key. A 4257 B PQ_KEYS arrives as
> ~13 fragments at 1480 B each; identify it by **size and fragmentation**, not by
> `zt.verb`. The capture above shows 13 such frames.
>
> The capability bit proves only that the peer *advertises* support. That the
> PQ exchange actually happened is a **state** question, answered in §6.3 —
> not something a dissector can show.
**Run tshark as your normal user, not root.** As superuser, Wireshark silently
skips user Lua scripts and the dissector appears to be broken. If the pcap lives
under a path the profile cannot read, copy it somewhere readable.
---
## 8. Troubleshooting — the three failure modes
All three are control-plane defects, none are crypto failures. In every case the
tell is `status: ACCESS_DENIED`, `peers: []`, and 100% multicast loss *on a
healthy direct path*.
### 8.1 B6 — controller compares identities the wire never carries
`status: ACCESS_DENIED`, no peer ever appears. Cause: the controller compared a
stored type-1 identity against the classic projection HELLO actually transports,
so they never matched. Fixed in 2.0.2 (`sameClassicIdentity()`).
**Check:** does HOST1's `controller.db` hold a member row whose address differs
from the address HOST2 presents today? Re-run §5b.
```sh
sudo -n python3 -m json.tool /var/lib/backone/controller.db | grep -A3 members
```
### 8.2 B7 — peer's PQ identity never completed
Status stays deferred; credentials never arrive. Cause: received PQ keys were
cached for crypto only and never written into the peer's `Identity`, so a type-2
membership double-signature could never verify. Fixed in 2.0.2.
**Check:** `pqcCapable: true` but `pqcHybridActive: false` and no peer. Confirm
you are on ≥ 2.0.2 (`backone -v`).
### 8.3 B8 — both nodes ran their own controller
`status: ACCESS_DENIED` **and** each host has its own
`/var/lib/backone/networks.d/<nwid>.conf` containing `id=<its own address>`.
Cause: no opt-out existed, so the member answered its own config requests and
signed its own config, never contacting the controller that owned the network.
**Fix:** set `disableController: true` on HOST2 (§0) and restart. Delete
HOST2's self-signed `networks.d/<nwid>.conf`, re-join, re-run §5b.
> This is why §0 pins the roles. If both hosts have a `networks.d/<nwid>.conf`,
> you are here regardless of what `status` says.
---
## 9. Running the classical baseline
Same procedure, mode flipped — needed to populate the right-hand column of §6.2.
1. §3 wipe **both** hosts.
2. HOST1 `local.conf`: `{"settings":{"pqcMode":"off"}}` (or omit `pqcMode`
entirely — absent means classic).
3. HOST2 `local.conf`: `{"settings":{"pqcMode":"off","disableController":true}}`.
4. Restart both; confirm `identity.public` is **141 B** and type byte `0`.
5. §5 create a **new** network, authorize HOST2, join.
6. §6.1 absolute gate — must still pass (classic is a supported mode).
7. §6.2 — record `pqcCapable`/`pqcHybridActive` as `false`, HELLO 1 fragment,
`zt.hello.cap == 0`.
Re-running §3 for the hybrid pass gives you a fresh type-1 identity and a new
network, which is exactly what the comparative table needs.
---
## 10. Quick reference
```sh
# HOST1 controller, HOST2 = 192.168.122.85
A=$(sudo -n cat /var/lib/backone/authtoken.secret)
N=<nwid>
# health
curl -s -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/network/$N # status/peers
curl -s -H "X-ZT1-Auth: $A" http://127.0.0.1:9993/peer # pqc flags
sudo /usr/sbin/backone-cli -p9993 -D/var/lib/backone peers # path table
# membership (HOST1)
curl -s -X POST -H "X-ZT1-Auth: $A" -H 'Content-Type: application/json' \
-d '{"authorized":true}' http://127.0.0.1:9993/controller/network/$N/member/$ADDR
# capture + dissect (HOST1)
sudo tcpdump -i any -s 0 -w /tmp/pq.pcap 'udp port 9993'
tshark -X lua_script:tools/zt-dissector.lua -r /tmp/pq.pcap -Y 'zt.hello.cap'
```
**Cleanup when done:** `sudo systemctl stop backone` on both hosts. Test networks
and the shared lab subnet are left as you found them.
---
## Appendix — where each claim comes from
| Claim | Source |
|---|---|
| `disableController` semantics and default | `service/README.md:46`, `service/OneService.cpp:1454-1459` |
| member authorize route + `authorized` field | `controller/EmbeddedNetworkController.cpp:879`, `:1175` |
| network create fields | `controller/EmbeddedNetworkController.cpp:620-766` |
| `VERB_HELLO = 0x01`, `VERB_PQ_KEYS = 0x17` | `node/Packet.hpp:617`, `:1103` |
| `MLKEM768_CT_LEN = 1088` | `node/PQHybrid.hpp:29` |
| B6/B7/B8 root causes and fixes | `docs/pqc-test-scenario.md` §9 |
| netns lab, M1–M5 matrix, classification rule | `docs/pqc-test-scenario.md` §4–§7 |
| dissector fields (`zt.hello.cap`, `zt.frag`, …) | `tools/zt-dissector.lua` |
+11
View File
@@ -342,6 +342,12 @@ endif
ifeq ($(ZT_CONTROLLER),1)
override CXXFLAGS+=-Wall -Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
ifeq ($(ZT_CONTROLLER_NO_SQL),1)
# Embedded controller on FileDB only: no PostgreSQL, Redis or smeeclient.
# controller/PostgreSQL.cpp is wholly #ifdef ZT_CONTROLLER_USE_LIBPQ, so it
# compiles to an empty translation unit and FileDB is selected by absence of
# the define (controller/EmbeddedNetworkController.cpp).
else
override LDLIBS+=-Lext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/lib -lpqxx -lpq ext/hiredis-1.0.2/lib/ubuntu22.04/$(EXT_ARCH)/libhiredis.a ext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/lib/libredis++.a -lssl -lcrypto
override DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_NO_PEER_METRICS
override INCLUDES+=-I/usr/include/postgresql -Iext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/include -Iext/hiredis-1.0.2/include/ -Iext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/include/sw/
@@ -351,6 +357,7 @@ ifeq ($(ZT_CONTROLLER),1)
override LDLIBS+=rustybits/target/release/libsmeeclient.a
endif
endif
endif
# ARM32 hell -- use conservative CFLAGS
ifeq ($(ZT_ARCHITECTURE),3)
@@ -467,8 +474,12 @@ zeroidc:
endif
ifeq ($(ZT_CONTROLLER), 1)
ifeq ($(ZT_CONTROLLER_NO_SQL),1)
smeeclient:
else
smeeclient: FORCE
export PATH=$$HOME/.cargo/bin:$$PATH; cd rustybits && cargo build $(ZT_CARGO_FLAGS) -p smeeclient
endif
else
smeeclient:
endif
+3 -2
View File
@@ -94,7 +94,7 @@ bool CertificateOfMembership::agreesWith(const CertificateOfMembership &other, c
return true;
}
bool CertificateOfMembership::sign(const Identity &with)
bool CertificateOfMembership::sign(const Identity &with,bool pqSign)
{
uint64_t buf[ZT_NETWORK_COM_MAX_QUALIFIERS * 3];
unsigned int ptr = 0;
@@ -109,7 +109,8 @@ bool CertificateOfMembership::sign(const Identity &with)
_signedBy = with.address();
// V14: if the signing identity is PQ capable, additionally ML-DSA-65
// sign the same bytes so the COM serializes as type 2 (double-sign).
if (with.hasPQPrivate()) {
// pqSign=false keeps it type 1 for a requester that cannot parse type 2.
if ((pqSign) && (with.hasPQPrivate())) {
std::shared_ptr<uint8_t> sig(new uint8_t[PQHybrid::MLDSA65_SIG_LEN], std::default_delete<uint8_t[]>());
if (! with.pqSign(buf, ptr * sizeof(uint64_t), sig.get())) {
_signedBy.zero();
+5 -1
View File
@@ -195,9 +195,13 @@ public:
* Sign this certificate
*
* @param with Identity to sign with, must include private key
* @param pqSign If true and the signing identity has PQ private keys,
* additionally ML-DSA-65 sign (COM type 2). Pass false to issue a classic
* type-1 COM that a pre-PQ peer can parse: a type 2 COM makes such a peer
* throw on the type byte and drop the whole network config.
* @return True if signature was successful
*/
bool sign(const Identity &with);
bool sign(const Identity &with,bool pqSign = true);
/**
* Verify this COM and its signature
+1 -1
View File
@@ -1,7 +1,7 @@
// PQC capability mode (local.conf settings.pqcMode / Identity::generate)
#define ZT_PQC_MODE_CLASSIC 0 // off: C25519 key agreement only
#define ZT_PQC_MODE_HYBRID 1 // hybrid: C25519 agreement with ML-KEM-768 mixed in
#define ZT_PQC_MODE_PQCONLY 2 // pqconly: PQ-only identities, no classic fallback
#define ZT_PQC_MODE_PQCONLY 2 // pqconly: same PQ material as hybrid, but enforces the peer requirement (see Peer::pqconlyPeerRejected)
/*
* Copyright (c)2019 ZeroTier, Inc.
+30
View File
@@ -1082,6 +1082,15 @@ bool IncomingPacket::_doNETWORK_CREDENTIALS(const RuntimeEnvironment *RR,void *t
return true;
}
// Same pqconly rule as _doNETWORK_CONFIG, and it matters most here: a COM is
// what establishes trust for a network, so letting one in over a silently
// classical link would reinstate exactly the downgrade the mode forbids.
if (peer->pqconlyPeerRejected()) {
Metrics::pkt_network_credentials_in_pqconly_rejected++;
RR->node->setPQCDowngradeWarning(peer->address(), true);
return false;
}
CertificateOfMembership com;
Capability cap;
Tag tag;
@@ -1221,6 +1230,17 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,void
const unsigned int hopCount = hops();
const uint64_t requestPacketId = packetId();
// pqconly must also refuse to *serve* config. The receive-side gates in
// _doNETWORK_CONFIG / _doNETWORK_CREDENTIALS only protect this node from a
// downgraded peer, but a classic peer asks us for its own config and we are
// the node in pqconly - gating only inbound let the network come up anyway.
if (peer->pqconlyPeerRejected()) {
Metrics::pkt_network_config_in_pqconly_rejected++;
RR->node->setPQCDowngradeWarning(peer->address(), true);
peer->received(tPtr,_path,hopCount,requestPacketId,payloadLength(),Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP,false,nwid,ZT_QOS_NO_FLOW);
return false;
}
if (RR->localNetworkController) {
const unsigned int metaDataLength = (ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN <= size()) ? at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN) : 0;
const char *metaDataBytes = (metaDataLength != 0) ? (const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength) : (const char *)0;
@@ -1247,6 +1267,16 @@ bool IncomingPacket::_doNETWORK_CONFIG(const RuntimeEnvironment *RR,void *tPtr,c
{
Metrics::pkt_network_config_in++;
const SharedPtr<Network> network(RR->node->network(at<uint64_t>(ZT_PACKET_IDX_PAYLOAD)));
// pqconly refuses a network whose config would arrive over a link that
// silently fell back to classical. Infrastructure roles are exempt inside
// pqconlyPeerRejected(). This must run before handleConfigChunk(), or the
// downgraded config is already applied by the time we notice.
if (peer->pqconlyPeerRejected()) {
Metrics::pkt_network_config_in_pqconly_rejected++;
RR->node->setPQCDowngradeWarning(peer->address(), true);
peer->received(tPtr,_path,hops(),packetId(),payloadLength(),Packet::VERB_NETWORK_CONFIG,0,Packet::VERB_NOP,false,at<uint64_t>(ZT_PACKET_IDX_PAYLOAD),ZT_QOS_NO_FLOW);
return false;
}
if (network) {
const uint64_t configUpdateId = network->handleConfigChunk(tPtr,packetId(),source(),*this,ZT_PACKET_IDX_PAYLOAD);
if (configUpdateId) {
+4
View File
@@ -54,10 +54,14 @@ namespace ZeroTier {
{ packets.Add({{"packet_type", "multicast_like"}, {"direction", "rx"}}) };
prometheus::simpleapi::counter_metric_t pkt_network_credentials_in
{ packets.Add({{"packet_type", "network_credentials"}, {"direction", "rx"}}) };
prometheus::simpleapi::counter_metric_t pkt_network_credentials_in_pqconly_rejected
{ packets.Add({{"packet_type", "network_credentials"}, {"direction", "rx"}, {"pqconly_rejected", "yes"}}) };
prometheus::simpleapi::counter_metric_t pkt_network_config_request_in
{ packets.Add({{"packet_type", "network_config_request"}, {"direction", "rx"}}) };
prometheus::simpleapi::counter_metric_t pkt_network_config_in
{ packets.Add({{"packet_type", "network_config"}, {"direction", "rx"}}) };
prometheus::simpleapi::counter_metric_t pkt_network_config_in_pqconly_rejected
{ packets.Add({{"packet_type", "network_config"}, {"direction", "rx"}, {"pqconly_rejected", "yes"}}) };
prometheus::simpleapi::counter_metric_t pkt_multicast_gather_in
{ packets.Add({{"packet_type", "multicast_gather"}, {"direction", "rx"}}) };
prometheus::simpleapi::counter_metric_t pkt_multicast_frame_in
+2
View File
@@ -41,7 +41,9 @@ namespace ZeroTier {
extern prometheus::simpleapi::counter_metric_t pkt_multicast_like_in;
extern prometheus::simpleapi::counter_metric_t pkt_network_credentials_in;
extern prometheus::simpleapi::counter_metric_t pkt_network_config_request_in;
extern prometheus::simpleapi::counter_metric_t pkt_network_credentials_in_pqconly_rejected;
extern prometheus::simpleapi::counter_metric_t pkt_network_config_in;
extern prometheus::simpleapi::counter_metric_t pkt_network_config_in_pqconly_rejected;
extern prometheus::simpleapi::counter_metric_t pkt_multicast_gather_in;
extern prometheus::simpleapi::counter_metric_t pkt_multicast_frame_in;
extern prometheus::simpleapi::counter_metric_t pkt_push_direct_paths_in;
+1 -1
View File
@@ -1311,7 +1311,7 @@ void Network::requestConfiguration(void *tPtr)
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_CAPABILITIES,(uint64_t)ZT_MAX_NETWORK_CAPABILITIES);
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_CAPABILITY_RULES,(uint64_t)ZT_MAX_CAPABILITY_RULES);
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_TAGS,(uint64_t)ZT_MAX_NETWORK_TAGS);
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS,(uint64_t)0);
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS,(uint64_t)((RR->node->pqcMode() != ZT_PQC_MODE_CLASSIC) ? ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE : 0));
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_RULES_ENGINE_REV,(uint64_t)ZT_RULES_ENGINE_REVISION);
rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_OS_ARCH,ZT_TARGET_NAME);
+6
View File
@@ -132,6 +132,12 @@ namespace ZeroTier {
// Network configuration meta-data flags
#define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS "f"
// Set in ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS by requesters that can
// parse PQ credential types (COM type 2, identity type 1). Absent means a
// classic requester, which cannot parse them, so the controller must issue
// classic-format credentials.
#define ZT_NETWORKCONFIG_REQUEST_METADATA_FLAG_PQ_CAPABLE 0x0001
// These dictionary keys are short so they don't take up much room.
// By convention we use upper case for binary blobs, but it doesn't really matter.
+63
View File
@@ -624,6 +624,11 @@ ZT_PeerList *Node::peers() const
// ever sees the ciphertext, so hybridEligible() reports True a full
// round trip early and the decapsulator's failure goes unnoticed.
p->pqcHybridActive = pi->second->hybridSessionKeyInstalled();
// A peer that has since advertised the capability clears its downgrade
// warning, so a later failure warns again instead of staying silent.
if (p->pqcCapable) {
setPQCDowngradeWarning(pi->second->identity().address(), false);
}
std::vector< SharedPtr<Path> > paths(pi->second->paths(_now));
SharedPtr<Path> bestp(pi->second->getAppropriatePath(_now,false));
@@ -749,6 +754,64 @@ void Node::setNetconfMaster(void *networkControllerInstance)
}
}
// Records a PQC downgrade and warns once per peer per state. Without this a
// node configured for hybrid/pqconly silently keeps running on the classical
// key against a peer that never offered PQ material, with no log line at all.
// Warns on entry to the downgraded state and again on recovery, so a peer that
// flaps is visible without log-spamming every packet.
void Node::setPQCDowngradeWarning(const Address &addr, bool rejected) const
{
if (_pqcMode == ZT_PQC_MODE_CLASSIC) {
return;
}
// Decide under the lock, print after it is released: fprintf under a lock
// would serialize every peer handshake behind the log write.
bool shouldWarn = false;
{
Mutex::Lock _l(_pqcDowngradeWarned_m);
bool known = false;
for(std::vector<Address>::iterator i=_pqcDowngradeWarned.begin();i!=_pqcDowngradeWarned.end();++i) {
if (*i == addr) {
known = true;
if (!rejected) {
_pqcDowngradeWarned.erase(i); // recovered, allow a future warning
}
break;
}
}
if (rejected) {
if (!known) {
_pqcDowngradeWarned.push_back(addr);
shouldWarn = true;
}
} else {
shouldWarn = known; // only report a recovery if we warned
}
}
if (!shouldWarn) {
return;
}
char addrStr[11];
addr.toString(addrStr);
if (rejected) {
fprintf(stderr,
"WARNING: peer %s cannot do post-quantum key exchange but this node is in pqcMode "
"%s; traffic to it is classical%s" ZT_EOL_S,
addrStr,
(_pqcMode == ZT_PQC_MODE_PQCONLY) ? "pqconly" : "hybrid",
(_pqcMode == ZT_PQC_MODE_PQCONLY) ? " and network config from it is REFUSED." : ".");
} else {
fprintf(stderr,
"INFO: peer %s now reports post-quantum capability; downgrade cleared." ZT_EOL_S,
addrStr);
}
}
/****************************************************************************/
/* Node methods used only within node/ */
/****************************************************************************/
+3
View File
@@ -100,6 +100,7 @@ public:
void clearLocalInterfaceAddresses();
int sendUserMessage(void *tptr,uint64_t dest,uint64_t typeId,const void *data,unsigned int len);
void setNetconfMaster(void *networkControllerInstance);
void setPQCDowngradeWarning(const Address &addr, bool rejected) const;
// Internal functions ------------------------------------------------------
@@ -345,6 +346,8 @@ public:
bool _online;
bool _lowBandwidthMode;
int _pqcMode;
mutable std::vector<Address> _pqcDowngradeWarned;
mutable Mutex _pqcDowngradeWarned_m;
};
} // namespace ZeroTier
+13
View File
@@ -23,6 +23,7 @@
#include "RingBuffer.hpp"
#include "SelfAwareness.hpp"
#include "Switch.hpp"
#include "Topology.hpp"
#include "Trace.hpp"
#include "Utils.hpp"
@@ -169,6 +170,18 @@ void Peer::ensurePendingHybridCt()
Utils::burn(hkey, sizeof(hkey));
}
bool Peer::pqconlyPeerRejected() const
{
if (RR->node->pqcMode() != ZT_PQC_MODE_PQCONLY) {
return false;
}
if (_hybridCapable) {
return false;
}
const ZT_PeerRole r = RR->topology->role(address());
return ((r != ZT_PEER_ROLE_PLANET) && (r != ZT_PEER_ROLE_MOON));
}
void Peer::received(
void *tPtr,
const SharedPtr<Path> &path,
+18
View File
@@ -433,6 +433,24 @@ public:
inline bool hybridEligible() const
{ return ((RR->node->pqcMode() != ZT_PQC_MODE_CLASSIC) && (_hybridCapable) && (RR->identity.hasPQ()) && _pqKeysValid); }
/**
* True when this node enforces pqconly and the peer is a non-infrastructure
* peer that cannot do PQ, i.e. traffic to it would be silently classical.
*
* The gate keys on _hybridCapable -- set once at HELLO and stable -- and not
* on hybridSessionKeyInstalled(). A capable peer stages its hybrid key until
* the confirm tag arrives, so testing the installed key would reject a
* perfectly good PQ peer for the whole staging window.
*
* Roots are exempt: planets and moons are infrastructure this node dials for
* world/world routing, they are not network members, and no classical planet
* build will ever advertise the capability bit. Enforcing against them would
* cut the node off from the root topology.
*
* Defined in Peer.cpp: Topology is only forward-declared here.
*/
bool pqconlyPeerRejected() const;
/**
* Rate limit gate for VERB_PUSH_DIRECT_PATHS
*/
+25
View File
@@ -808,6 +808,31 @@ static int testCertificate()
}
}
std::cout << "PASS" << std::endl;
// A controller must be able to issue a classic type-1 COM even when its
// signing identity holds PQ keys: a pre-PQ requester parses only type 1
// and throws on type 2, silently dropping the whole network config.
std::cout << "[certificate] PQ authority can issue classic COM on demand... ";
CertificateOfMembership c1pq(10000, 100, 1, idA);
if ((! c1pq.sign(pqAuthority, false)) || (c1pq.pqSignature() != (const uint8_t*)0)) {
std::cout << "FAIL (sign)" << std::endl;
return -1;
}
b.clear();
c1pq.serialize(b);
if (b[0] != 1) {
std::cout << "FAIL (type byte)" << std::endl;
return -1;
}
{
CertificateOfMembership c1pqb;
c1pqb.deserialize(b, 0);
if (c1pqb != c1pq) {
std::cout << "FAIL (round trip)" << std::endl;
return -1;
}
}
std::cout << "PASS" << std::endl;
}
// A controller holds the member's full identity (type 1) but only ever sees
+1 -1
View File
@@ -38,7 +38,7 @@ Settings available in `local.conf` (this is not valid JSON, and JSON does not al
"softwareUpdateChannel": "release"|"beta", /* Software update channel */
"softwareUpdateDist": true|false, /* If true, distribute software updates (only really useful to ZeroTier, Inc. itself, default is false) */
"interfacePrefixBlacklist": [ "XXX",... ], /* Array of interface name prefixes (e.g. eth for eth#) to blacklist for ZT traffic */
"allowManagementFrom": [ "NETWORK/bits", ...] |null, /* If non-NULL, allow JSON/HTTP management from this IP network. Default is 127.0.0.1 only. */
"allowManagementFrom": [ "NETWORK/bits", ...] |null, /* If non-NULL, allow JSON/HTTP management from this IP network. Default is 127.0.0.1 only. Enforced at service/OneService.cpp:1859: a non-loopback source is refused with 401 and body `{}` *before* the auth token is compared, so publishing the port through a container, port-forward or NAT edge grants no access. Widen this and the token becomes a credential exposed to that network. */
"bind": [ "ip",... ], /* If present and non-null, bind to these IPs instead of to each interface (wildcard IP allowed) */
"allowTcpFallbackRelay": true|false, /* Allow or disallow establishment of TCP relay connections (true by default) */
"multipathMode": 0|1|2, /* multipath mode: none (0), random (1), proportional (2) */
+183
View File
@@ -0,0 +1,183 @@
#!/usr/bin/env bash
# Gate for the controller image: prove the embedded controller is live on
# FileDB, not merely linked.
#
# Compile success is not evidence. `ZT_CONTROLLER=1` on a box with libpq
# present but unconfigured builds cleanly and silently falls back, which is
# exactly the failure this gate exists to catch (SPEC.md V21, §C).
#
# Usage:
# tools/controller-image-gate.sh # docker: build image + run
# tools/controller-image-gate.sh --local # test ./backone directly
# tools/controller-image-gate.sh --image NAME # test an existing image
set -uo pipefail
MODE=docker
IMAGE=backone-controller
PORT=19993
NWID=8056c5e10c000000
while [[ $# -gt 0 ]]; do
case "$1" in
--local) MODE=local; shift ;;
--image) MODE=image; IMAGE="$2"; shift 2 ;;
--port) PORT="$2"; shift 2 ;;
*) echo "unknown arg: $1" >&2; exit 2 ;;
esac
done
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
fail=0
ok() { echo " ok $*"; }
bad() { echo " FAIL $*"; fail=1; }
say() { echo; echo "== $*"; }
CURL=(curl -sS --max-time 10)
# ---------------------------------------------------------------- local mode
if [[ "$MODE" == local ]]; then
BIN="$ROOT/backone"
[[ -x "$BIN" ]] || { echo "no ./backone -- run: make ZT_CONTROLLER=1 ZT_CONTROLLER_NO_SQL=1 one" >&2; exit 2; }
HOMEDIR="$(mktemp -d /tmp/bo-gate.XXXXXX)"
CID=""
trap '[[ -n "$CID" ]] && kill "$CID" 2>/dev/null; rm -rf "$HOMEDIR"' EXIT
say "V21: binary carries no SQL backend symbols"
if nm -C "$BIN" 2>/dev/null | grep -qiE 'pqxx|PostgreSQL::|sw::redis|smeeclient'; then
bad "found PostgreSQL/Redis/smeeclient symbols in $BIN"
else
ok "no pqxx / PostgreSQL:: / sw::redis / smeeclient symbols"
fi
if ldd "$BIN" | grep -qiE 'libpq|libssl|libcrypto'; then
bad "binary dynamically links libpq/libssl/libcrypto"
else
ok "no libpq/libssl/libcrypto in ldd"
fi
say "controller answers on FileDB"
"$BIN" -p"$PORT" -U "$HOMEDIR" >"$HOMEDIR/log" 2>&1 &
CID=$!
else
# ------------------------------------------------------------ docker mode
if [[ "$MODE" == image ]]; then
say "using existing image $IMAGE"
else
say "building image $IMAGE from Dockerfile.controller"
# shellcheck disable=SC2086
sudo -n docker build -f "$ROOT/Dockerfile.controller" -t "$IMAGE" "$ROOT" || exit 2
fi
say "V21: binary carries no SQL backend symbols"
# The runtime image is intentionally minimal and has no nm/strings, so
# asserting "nm -C ... found nothing" there would pass even if the tool
# were simply absent. Test with the tool that exists, and let a missing
# tool fail rather than pass.
if sudo -n docker run --rm --entrypoint sh "$IMAGE" -c \
"! grep -qaE 'pqxx|PostgreSQL__|sw__redis|smeeclient' /usr/sbin/backone"; then
ok "no pqxx / PostgreSQL / sw::redis / smeeclient strings in image binary"
else
bad "SQL backend strings present in image binary"
fi
say "controller answers on FileDB"
NAME="bo-gate-$$"
# --network host, not -p: the API authorizes loopback only unless
# settings.allowManagementFrom widens it (OneService.cpp:1859-1905), and a
# published port DNATs, so the request arrives from the bridge gateway and
# gets 401 no matter how correct the token is. Host networking keeps the
# request on loopback and exercises the posture operators actually get.
sudo -n docker run -d --name "$NAME" --network host \
-v "$NAME:/var/lib/backone" \
"$IMAGE" /usr/sbin/backone -U -p"$PORT" >/dev/null || exit 2
trap 'sudo -n docker rm -f "$NAME" >/dev/null 2>&1; sudo -n docker volume rm -f "$NAME" >/dev/null 2>&1' EXIT
fi
# ------------------------------------------------------------------- shared
API="http://127.0.0.1:$PORT"
TOKEN=""
for _ in $(seq 1 30); do
if [[ "$MODE" == local ]]; then
[[ -s "$HOMEDIR/authtoken.secret" ]] && { TOKEN="$(cat "$HOMEDIR/authtoken.secret")"; break; }
else
TOKEN="$(sudo -n docker exec "$NAME" cat /var/lib/backone/authtoken.secret 2>/dev/null)" && [[ -n "$TOKEN" ]] && break
fi
sleep 1
done
if [[ -z "$TOKEN" ]]; then
bad "daemon never produced an auth token (see logs)"
[[ "$MODE" == local ]] && cat "$HOMEDIR/log"
[[ "$MODE" != local ]] && sudo -n docker logs "$NAME" 2>&1 | tail -20
exit 1
fi
ok "daemon up, control plane listening on $PORT"
# The token is written before the control plane finishes binding, and the API
# can answer /status a moment before the node reports itself online, so wait
# for the online field rather than sleeping a fixed amount.
STATUS=""
for _ in $(seq 1 30); do
STATUS="$("${CURL[@]}" -H "X-ZT1-Auth: $TOKEN" "$API/status" 2>/dev/null)"
echo "$STATUS" | grep -q '"online":true' && break
sleep 1
done
if ! echo "$STATUS" | grep -q '"online":true'; then
bad "node never reported online:true -- got: ${STATUS:0:200}"
[[ "$MODE" == local ]] && tail -20 "$HOMEDIR/log"
[[ "$MODE" != local ]] && sudo -n docker logs "$NAME" 2>&1 | tail -20
exit 1
fi
ok "control plane answered /status with online:true"
# create a network: proves the controller, not just the API server.
CREATE="$("${CURL[@]}" -H "X-ZT1-Auth: $TOKEN" -X POST \
-d '{"name":"gate","private":true}' "$API/controller/network/$NWID" 2>/dev/null)"
if echo "$CREATE" | grep -q '"id":"'"$NWID"'"'; then
ok "controller created network $NWID"
else
bad "controller did not create network $NWID -- got: ${CREATE:0:200}"
bad "a controller that is absent or on an unconfigured backend answers exactly like this"
exit 1
fi
# authorize a member: proves the write path through the DB.
PUB="$(echo "$STATUS" | sed -n 's/.*"publicIdentity":"\([^"]*\)".*/\1/p')"
MID="${PUB%%:*}"
if [[ -n "$MID" && ${#MID} -eq 10 ]]; then
AUTH="$("${CURL[@]}" -H "X-ZT1-Auth: $TOKEN" -X POST \
-d "{\"authorized\":true,\"identity\":\"$PUB\"}" \
"$API/controller/network/$NWID/member/$MID" 2>/dev/null)"
if echo "$AUTH" | grep -q '"authorized":true'; then
ok "controller authorized member $MID"
else
bad "member authorize failed -- got: ${AUTH:0:200}"
fi
LIST="$("${CURL[@]}" -H "X-ZT1-Auth: $TOKEN" "$API/controller/network/$NWID/member" 2>/dev/null)"
if echo "$LIST" | grep -q "$MID"; then
ok "member $MID reads back from the member list"
else
bad "member list did not contain $MID -- got: ${LIST:0:200}"
fi
else
bad "could not derive a 10-hex member id from /status publicIdentity"
fi
# state must be on disk, not just in memory.
if [[ "$MODE" == local ]]; then
NFILE="$HOMEDIR/controller.d/network/$NWID.json"
[[ -f "$NFILE" ]] && ok "FileDB wrote $NFILE" || bad "no FileDB network file at $NFILE"
else
if sudo -n docker exec "$NAME" test -f "/var/lib/backone/controller.d/network/$NWID.json"; then
ok "FileDB wrote controller.d/network/$NWID.json"
else
bad "no FileDB network file in the container"
fi
fi
echo
if [[ $fail -eq 0 ]]; then
echo "PASS: controller live on FileDB, no SQL backend linked"
exit 0
fi
echo "FAIL: see above"
exit 1
+16 -4
View File
@@ -10,6 +10,10 @@ local IDENTITY_SIZE_CLASSIC = 39 -- 5 addr + 1 type + 32 pub + 1 privlen
local IDENTITY_SIZE_PQ = 3175 -- classic + 1184 ML-KEM-768 pk + 1952 ML-DSA-65 pk
local HELLO_IDENTITY_OFF = 13 -- payload + (pv1+maj1+min1+rev2+timestamp8)
local CIPHER_NONE = 0 -- C25519_POLY1305_NONE, payload left in the clear
local CIPHER_SALSA20 = 1 -- C25519_POLY1305_SALSA2012
local CIPHER_AES_GCM = 3 -- AES_GMAC_SIV
local f = {
iv = ProtoField.bytes("zt.iv", "Packet ID / IV"),
dest = ProtoField.string("zt.dest", "Destination"),
@@ -83,14 +87,22 @@ function zt.dissector(buf, pinfo, tree)
if buf:len() < 28 then return end
local verb = buf(27, 1):uint()
local encrypted = bit.band(buf(18, 1):uint(), 0x80) ~= 0
local t = tree:add(zt, buf(), "BackOne, verb " .. verb)
-- Cipher suite lives in flags bits 3-5 (FFCCCHHH, Packet.hpp:1319). Suite 0
-- (C25519_POLY1305_NONE) leaves the payload in the clear; suites 1 and 3
-- encrypt from ZT_PACKET_IDX_VERB (27) onward, so byte 27 is ciphertext and
-- must not be presented as a verb. Checking only the pre-1.0.3 0x80 bit
-- misreads every AES-GCM frame, which is what a PQ link uses.
local cipher = bit.band(bit.rshift(buf(18, 1):uint(), 3), 0x07)
local encrypted = (cipher ~= CIPHER_NONE) and (cipher == CIPHER_SALSA20 or cipher == CIPHER_AES_GCM)
local verb = encrypted and 0 or buf(27, 1):uint()
local t = tree:add(zt, buf(), encrypted and "BackOne, encrypted" or ("BackOne, verb " .. verb))
t:add(f.iv, buf(0, 8))
t:add(f.dest, addr(buf, 8))
t:add(f.src, addr(buf, 13))
t:add(f.flags, buf(18, 1))
t:add(f.verb, buf(27, 1))
if not encrypted then
t:add(f.verb, buf(27, 1))
end
-- Head of a fragmented packet still carries the original header, so the
-- verb and the leading payload bytes are parseable.
+1 -1
View File
@@ -27,7 +27,7 @@
/**
* Revision
*/
#define ZEROTIER_ONE_VERSION_REVISION 2
#define ZEROTIER_ONE_VERSION_REVISION 4
/**
* Build version