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.
This commit is contained in:
1 parent
727e31b33d
commit
975148525b
2 files changed
+188
-2
No files matched your search
@@ -0,0 +1,175 @@
|
||||
# `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 the third mode and records what it
|
||||
actually does, which is not what its name implies.
|
||||
|
||||
**Headline result (measured 2026-10-08, two real hosts):** `pqconly` behaves
|
||||
**identically to `hybrid` at runtime**. It does not fail closed, it does not
|
||||
refuse classical peers, and it carries traffic with a peer that has no PQ
|
||||
capability. Treat it as a synonym for `hybrid`, not as a stricter policy mode.
|
||||
|
||||
---
|
||||
|
||||
## 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** |
|
||||
|
||||
The `Identity.hpp:4` comment states the intent plainly: *"pqconly: PQ-only
|
||||
identities, no classic fallback."*
|
||||
|
||||
## 2. What it actually does
|
||||
|
||||
Only one runtime site distinguishes the modes — 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 tests only `!= CLASSIC`, so `hybrid` and
|
||||
`pqconly` are 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 finds no other `ZT_PQC_MODE_PQCONLY` reference in compiled code.
|
||||
Nothing rejects a non-capable peer when `pqconly` is set.
|
||||
|
||||
## 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`. Identical results confirm the modes share a code path.
|
||||
|
||||
### 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.
|
||||
|
||||
Then, with HOST1 on `pqconly` and HOST2 now classical:
|
||||
|
||||
```
|
||||
# HOST1's view of the classical peer
|
||||
e17bdf70bb capable=False hybrid=False paths=3
|
||||
|
||||
# HOST1 -> HOST2 overlay IP
|
||||
4 packets transmitted, 4 received, 0% packet loss
|
||||
```
|
||||
|
||||
**`pqconly` exchanged packets with a peer that has no PQ keys at all.** If the
|
||||
mode meant what it says, `paths` would be 0 and the ping would fail.
|
||||
|
||||
## 4. Interpretation
|
||||
|
||||
A `pqconly` node is not protected against downgrade. An attacker who can keep a
|
||||
peer from ever exchanging PQ material leaves the link on the classical session
|
||||
key, and `pqcHybridActive` will simply report `false` — quietly, with no log line
|
||||
and no refusal to forward traffic.
|
||||
|
||||
Two consequences:
|
||||
|
||||
1. **`pqconly` must not be relied on as a policy control.** It selects an
|
||||
identity type. It does not enforce a peer requirement.
|
||||
2. **Monitoring `pqcHybridActive` is the only available detection.** A peer that
|
||||
should be hybrid but reports `hybrid=False` is a downgrade, and nothing else
|
||||
in the node will tell you.
|
||||
|
||||
Making the mode real would mean gating `hybridEligible()` — or a sibling check —
|
||||
on `== ZT_PQC_MODE_PQCONLY`, and dropping peers that fail it. That is a behavior
|
||||
change and is **not** implemented today.
|
||||
|
||||
## 5. 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.
|
||||
|
||||
## 6. 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.
|
||||
@@ -139,10 +139,21 @@ stat -c '%s' /var/lib/backone/identity.public
|
||||
|---|---|---|
|
||||
| absent / `off` | **141 B** | `0` (classic) |
|
||||
| `hybrid` | **6415 B** | `1` (type 1, PQ) |
|
||||
| `pqconly` | 6415 B | `1` |
|
||||
| `pqconly` | 6415 B | `1` — **behaves identically to `hybrid`, see below** |
|
||||
|
||||
> **`pqconly` is not a stricter mode.** Despite the "no classic fallback" comment
|
||||
> in `node/Identity.hpp:4`, it only forces a type-1 identity at generation
|
||||
> (`node/Identity.cpp:109`); every runtime gate tests `pqcMode() != CLASSIC`, so
|
||||
> it shares a code path with `hybrid`. Measured: a `pqconly` node carried traffic
|
||||
> with a fully classical peer, 0% loss. See
|
||||
> [`pqconly-mode-test.md`](./pqconly-mode-test.md) for the full result 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
|
||||
od -An -tu1 -N1 /var/lib/backone/identity.public # expect 1 under hybrid
|
||||
cut -d: -f2 /var/lib/backone/identity.public # expect 1 under hybrid
|
||||
/usr/sbin/backone-idtool validate /var/lib/backone/identity.public
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user