tpm-enrol: move signing key off the EK slot 0x81010001 → 0x81000100
Bench (Proxmox vTPM, host cygnus-cruiser-99) confirmed via tpm2_readpublic that
0x81010001 — the handle our design used for the fleet signing key — is the
TCG-standard RSA Endorsement Key slot: the object there is the swtpm-provisioned
EK (restricted|decrypt|adminwithpolicy, RSA-2048/AES128CFB, canonical EK
authPolicy 837197…, EK cert at NV 0x1c00002). Most firmware/swtpm TPMs occupy
that slot, so EnsureKey could never create our key there — it errored reading
the EK as ECC and enrolment died before the CSR/POST.
Move the fleet signing key to 0x81000100, a non-reserved owner persistent
handle (clear of EK 0x81010001/2 and SRK 0x81000001/2). Threaded through:
- fleet-enrol -handle default + new rd.dot1x.handle= cmdline knob (baked by
extract-artifacts.sh, overridable via SMBIOS)
- files/etc/dot1x/wpa_supplicant-dot1x.conf private_key handle
- the dracut hook, bench tpm-provision.sh / tpm-selftest.sh
- CLAUDE.md invariant #1 + design/SSP docs + TODO #11
NV index 0x01800001 (owner range) is unchanged.
EnsureKey hardening: refuse to evict any restricted-decrypt object (EK/SRK) as
a safety net — never clobber the TPM endorsement/storage identity (also
protects the future EK/AK attestation path). Still self-heals a genuine stale
signing key. New regression TestEnsureKeyRefusesToEvictProtectedKey; the
stale-key regression and handle constants moved to 0x81000100.
Design note records the IDevID (0x81020001) option for the later EK/AK
attestation work. Follow-up items logged: content-aware NV presence check
(verify the cert chains to the fleet CA, so leftover/foreign NV can't suppress
enrolment) and a de-enrol/TPM-reset procedure.
This commit is contained in:
+54
-21
@@ -766,7 +766,7 @@ smoke test.
|
||||
returns MSK); a `hostapd` wired authenticator does 802.1X + MACsec on an
|
||||
**isolated bridge per workstation** (flat VLAN can't auth — EAPOL dropped +
|
||||
MACsec is P2P). `enrol/tpm-provision.sh` creates the key in the TPM at
|
||||
`0x81010001` + writes the cert to NV `0x01800001`. Starting solution **signs a
|
||||
`0x81000100` + writes the cert to NV `0x01800001`. Starting solution **signs a
|
||||
CSR** (key stays in TPM); **TPM attestation** (ACME `device-attest-01`) is the
|
||||
documented upgrade on the same CA. **BENCH-VERIFY** items flagged in the files:
|
||||
hostapd MACsec build, openssl tpm2 provider vs pkcs11 key ref, EAP-TLS version.
|
||||
@@ -775,7 +775,7 @@ smoke test.
|
||||
capability check (run on the booted open-port image, no `disable_dot1x` needed)
|
||||
to de-risk the TPM half before the full path. Likely first finding: no openssl
|
||||
TPM2 **provider** in the image (`tpm2-tss` ≠ the provider) — add `tpm2-openssl`.
|
||||
- **Enrolment of the per-host identity** (key@`0x81010001` + cert@NV) is its own
|
||||
- **Enrolment of the per-host identity** (key@`0x81000100` + cert@NV) is its own
|
||||
design — see **#11** (TOFU + OOB fingerprint broker, pre-auth permit-set,
|
||||
provisioning UKI). `tpm-provision.sh` is the manual bench stand-in for it.
|
||||
- **NVMe discovery by DNS:** `nvmet_traddr=nvme.fleet.lab` (CI), resolved at boot
|
||||
@@ -968,7 +968,7 @@ enrolls.
|
||||
every NIC/GPU option ROM is covered by your keys — clearing MS db can break
|
||||
signed **option ROMs** (NIC PXE/HTTP-boot, GPU init), bricking the boot path.
|
||||
- **PCR 7 check:** enrollment changes the Secure Boot measurement in PCR 7;
|
||||
confirm nothing the fleet seals to the TPM (the EAP-TLS key at `0x81010001`,
|
||||
confirm nothing the fleet seals to the TPM (the EAP-TLS key at `0x81000100`,
|
||||
NV cert) is PCR-7-policy-bound before relying on this.
|
||||
|
||||
**Decision before building:** auto-enroll trades assurance for convenience and is
|
||||
@@ -1007,7 +1007,7 @@ it talks to `/dev/tpmrm0` DIRECTLY (via `transport.FromReadWriter` on an
|
||||
`os.File` — no `linuxtpm`, so go-tpm is the only vendored dep), so the enrolment
|
||||
path needs **no tpm2-tools key-gen / no openssl tpm2 provider / no curl** in the
|
||||
image (removes the biggest bench risk — the provider `handle:` key-ref). It
|
||||
ensures the ECDSA key at `0x81010001`, builds the CSR, POSTs CSR+context to
|
||||
ensures the ECDSA key at `0x81000100`, builds the CSR, POSTs CSR+context to
|
||||
`rd.fleet.enrol_url`, shows the broker fingerprint on Plymouth, polls `/status`,
|
||||
and writes the leaf cert to NV `0x01800001`. The dracut hook `tpm-enrol.sh`
|
||||
(initqueue/settled prio 25) is now a thin GATE: empty-NV check (`tpm2_nvread`,
|
||||
@@ -1038,22 +1038,55 @@ ECDSA sign → CSR verify → chunked NV write → re-enrol) against the go-tpm
|
||||
simulator** (separate `files/enrol/simtest/` module so the CGO simulator never
|
||||
enters the shipped build). Both run in CI.
|
||||
|
||||
**BENCH FINDING 2026-07-02 (FIXED, commit c574fa4) — stale non-ECC key at the
|
||||
handle.** First real-TPM boot (host `cygnus-cruiser-99`, `rd.dot1x=0`) failed:
|
||||
`fleet-enrol: ensure key at 0x81010001: key at handle is not ECC: did not contain
|
||||
eccDetail (selector value was 1)`. The host already had an **RSA** key persisted at
|
||||
`0x81010001` (from an older tpm2-tools/openssl provisioning path); `EnsureKey`
|
||||
fatally errored reading it as ECC → enrolment died before the CSR/POST, so the
|
||||
splash flashed "FIRST-BOOT TPM ENROLMENT" then the test system booted with **no
|
||||
fingerprint and nothing at the broker**. Fix: `EnsureKey` now **evicts a
|
||||
wrong-type/unusable key and recreates** a fresh ECC key (safe on the enrol path —
|
||||
empty NV, no cert references the old key); a valid ECC key is still reused.
|
||||
Regression `simtest/TestEnsureKeyEvictsStaleNonECC` (pre-plants an RSA key). **Needs
|
||||
a rebuild + re-boot to confirm on the bench** (the sim proves the recovery, not the
|
||||
device). ⚠ **Don't hand-run `sudo fleet-enrol` on the booted STIG host to test** —
|
||||
the confined admin domain (`sysadm_t`) is SELinux-**denied** write to
|
||||
`/dev/tpmrm0` (`avc: denied … tpm_device_t`), so it fails before the TPM regardless;
|
||||
the faithful path is the **initramfs** run (reboot) which is unconfined.
|
||||
**BENCH FINDING 2026-07-02 (FIXED) — the signing-key handle `0x81000100` was the
|
||||
EK slot; moved to `0x81000100`.** First real-TPM boot (host `cygnus-cruiser-99`,
|
||||
Proxmox vTPM, `rd.dot1x=0`) failed: `fleet-enrol: ensure key at 0x81010001: key at
|
||||
handle is not ECC: did not contain eccDetail (selector value was 1)`. `EnsureKey`
|
||||
died reading an existing RSA object as ECC → enrolment died before the CSR/POST, so
|
||||
the splash flashed "FIRST-BOOT TPM ENROLMENT" then the test system booted with **no
|
||||
fingerprint and nothing at the broker**. Root cause (confirmed via `tpm2_readpublic`
|
||||
under `enforcing=0`): **`0x81000100` is the TCG-standard RSA Endorsement Key handle**
|
||||
— the object there was the swtpm-provisioned **EK** (`restricted|decrypt|adminwithpolicy`,
|
||||
RSA-2048/AES128CFB, canonical EK authPolicy `837197674484b3f8…`), with its EK cert at
|
||||
NV `0x1c00002`. Our design squatted the EK slot fleet-wide (most firmware/swtpm TPMs
|
||||
have their EK there), so enrolment could never create our key.
|
||||
- **Fix (commit c574fa4 + follow-up):** the fleet signing key moved to
|
||||
**`0x81000100`** (non-reserved owner handle; threaded through `fleet-enrol
|
||||
-handle` default, `rd.dot1x.handle=` cmdline knob baked by `extract-artifacts.sh`,
|
||||
`wpa_supplicant-dot1x.conf`, the bench scripts, invariant #1, and the design docs).
|
||||
NV `0x01800001` (owner range) is unchanged.
|
||||
- **EnsureKey hardening:** (i) evicts a genuine *stale signing key* at the handle
|
||||
and recreates (self-heal for old provisioning leftovers); (ii) **refuses to evict
|
||||
any restricted-decrypt object (EK/SRK)** as a safety net — never clobber the TPM's
|
||||
endorsement/storage identity (also protects the future EK/AK attestation).
|
||||
Regressions: `simtest/TestEnsureKeyEvictsStaleNonECC` + `TestEnsureKeyRefusesToEvictProtectedKey`.
|
||||
- **IDevID note (future):** if EK/AK attestation (`device-attest-01`, §"Stronger
|
||||
assurance") lands, the natural home for a TPM device-identity key is the TCG
|
||||
**IDevID** handle `0x81020001` (LDevID `0x81030001`) — see tpm-enrolment-design.md.
|
||||
Not adopted for v1 (implies the IDevID template/cert conventions).
|
||||
- **Also seen — leftover NV suppresses enrolment:** a *different* host (the 820)
|
||||
booted `tpm-enrol: client cert present at NV 0x01800001 — normal boot` with nothing
|
||||
enrolled this session — leftover NV state (from an earlier `tpm-provision.sh` /
|
||||
`tpm-selftest.sh --use-real-handles`) **persists in the hardware TPM** across
|
||||
reinstalls. Our presence check is content-blind (index defined ⇒ "enrolled"), so
|
||||
foreign/stale NV silently skips enrolment (→ secure-path auth would then fail). See
|
||||
the **content-aware NV check** item below.
|
||||
- **Needs a rebuild + re-boot to confirm** (the sim proves the ceremony, not the
|
||||
device). ⚠ **Don't hand-run `sudo fleet-enrol` on the booted STIG host** — the
|
||||
confined admin domain (`sysadm_t`) is SELinux-**denied** write to `/dev/tpmrm0`
|
||||
(`avc: denied … tpm_device_t`); the faithful path is the **initramfs** run
|
||||
(reboot, unconfined), or `enforcing=0` for hand-run TPM inspection.
|
||||
|
||||
**FOLLOW-UP HARDENING (from the two findings above, not yet built):**
|
||||
- **Content-aware NV presence check** — read NV `0x01800001`, parse as X.509, verify
|
||||
it **chains to the fleet CA** (bundled `radius-ca.pem`); only then treat as enrolled,
|
||||
else enrol + overwrite (`WriteNVCert` already undefine+redefines). Cleanest as a
|
||||
`fleet-enrol -check-only` mode (no network) the hook calls — one content-aware source
|
||||
of truth, replacing the hook's blind `tpm2_nvread` and the binary's `NVPresent`
|
||||
(defined-only). Stops leftover/foreign NV from suppressing enrolment.
|
||||
- **De-enrol / TPM-reset procedure** for re-testing: `tpm2_nvundefine 0x01800001 -C o`
|
||||
(+ `tpm2_evictcontrol -C o -c 0x81000100` for a stale *app* key — never the EK), or
|
||||
BIOS "Clear TPM". Document in the bench README.
|
||||
|
||||
**BENCH-VERIFY (host side, before trusting):** (a) go-tpm against a REAL TPM +
|
||||
swtpm on the target (the simulator proves the ceremony, not the device) — **the
|
||||
@@ -1101,7 +1134,7 @@ Verification found + fixed two things the `mock` path had hidden:
|
||||
FreeRADIUS (next, before host enrolment).
|
||||
|
||||
How a host gets its **802.1X EAP-TLS client identity** the first time — the key at
|
||||
TPM handle `0x81010001` + cert at NV `0x01800001` that invariant #1 says must come
|
||||
TPM handle `0x81000100` + cert at NV `0x01800001` that invariant #1 says must come
|
||||
from enrolment, never the image. Distinct from #10 (that enrols *Secure Boot*
|
||||
PK/KEK/db); this enrols the *network identity*. They share the provisioning UKI +
|
||||
isolated-environment vehicle. Pairs with #8 + the CA decision (start **step-ca**,
|
||||
|
||||
Reference in New Issue
Block a user