Commit Graph
59 Commits
Author SHA1 Message Date
Audiobuzz 4d6f038e3c 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.
2026-07-02 12:19:59 +00:00
Audiobuzz 4c55ed4b26 docs/TODO #11: record stale non-ECC key bench finding + SELinux hand-run caveat 2026-07-02 11:43:31 +00:00
Audiobuzz 1e1265b5a0 docs/TODO: add #15 — scope root overlay to per-subtree tmpfs (un-shadowable /usr + STIG mount options)
Captures the design + quantified STIG payoff (~21 mount/partition rules
notapplicable/waived -> pass, per reports/stig-arf.xml), the writable-set +
noexec/nosuid/nodev flag matrix, the kiosk-/tmp-noexec prerequisite, the
fstab-vs-runtime OVAL note, and that it's bench-gated after TPM enrolment (#11).
2026-07-02 11:31:33 +00:00
Audiobuzz 545d459c3d tpm-enrol: allow enrolment under rd.dot1x=0 (test-mode) for bench testing
Removes the hard no-op on the test path so the enrolment flow can be exercised
on a host with a TPM + a reachable broker WITHOUT standing up 802.1X/MACsec/
RADIUS. Networking is now mode-aware: in test mode ip=dhcp already owns the NIC
(and wrote resolv.conf), so the hook uses the existing lease instead of running
its own nmcli DHCP — avoiding the dracut "address already assigned" race
(CLAUDE.md "don't double-configure the NIC in test mode"). Secure mode still does
the nm-unmanaged override for the pre-auth lease. rd.fleet.enrol=0 disables
enrolment in either mode; production intent stays secure-path-only.
2026-07-02 10:00:26 +00:00
Audiobuzz 6278f2847d tpm-enrol: pivot host enrolment to a Go binary, built out-of-VM
Replaces the shell/openssl-provider host enrolment (a35f2d6) with a static
Go + go-tpm binary, and moves BOTH host Go binaries out of the Packer VM.

fleet-enrol (files/enrol/, Go + go-tpm, no CGO):
  - talks to /dev/tpmrm0 DIRECTLY via transport.FromReadWriter(os.File) — no
    linuxtpm, so go-tpm is the only dep and there is NO tpm2-tools key-gen /
    openssl tpm2 provider / curl in the image (removes the biggest bench risk,
    the provider handle: key-ref).
  - ensures the ECDSA key @0x81010001, builds the CSR (crypto.Signer over the
    TPM key), POSTs CSR+context to the broker, shows the Plymouth fingerprint,
    polls /status, writes the leaf cert to NV 0x01800001.
  - tpmkey/ is an exported package so the TPM ceremony is tested against the
    go-tpm software simulator from a SEPARATE simtest/ module (CGO stays out of
    the shipped build). Transaction logic (mock broker) tested in-package.
  - deps pinned by go.sum (not vendored): the binary now builds on the CI
    runner, which has network — reproducible via pinned Go 1.26.4 + go.sum.

Out-of-VM build (decision): both fleet-enrol AND fleet-hostapi compile in the
CI "Build host Go binaries" step (Go 1.26.4, CGO off, -trimpath) and Packer
FILE-PROVISIONS the static binaries in. Dropped the in-VM `dnf install golang`
+ the 2d removal — the Rocky build image carries no Go toolchain / go-tpm tree.

Wiring:
  - tpm-enrol.sh: now a thin GATE (empty-NV check, pre-auth DHCP on en*,
    exec /usr/sbin/fleet-enrol, reboot-to-converge). module-setup.sh bundles the
    binary (asserted) + reverts the tpm2-openssl/curl installs.
  - diskless.pkr.hcl: file provisioners for both binaries; enrol installed to
    /usr/sbin before the initramfs build + fapolicyd-trusted; lsinitrd asserts
    fleet-enrol; dnf reverted to baseline (no tpm2-openssl/curl).
  - gitea-main-ci.yaml: Set up Go + build both binaries + run the simulator
    ceremony test, before packer validate.

TESTED here: transaction unit tests + the full TPM ceremony (key-gen -> persist
-> ECDSA sign -> CSR verify -> chunked NV write -> re-enrol) against the go-tpm
simulator. BENCH-VERIFY (real/swtpm, empty owner auth, pre-auth DHCP, Plymouth,
reboot-converge, prod HTTPS) tracked in docs/TODO.md #11.
2026-07-02 09:55:54 +00:00
Audiobuzz 8e1d40a30b tpm-enrol: inline empty-NV first-boot enrolment (host side, TODO #11)
Builds the host side of TPM identity enrolment — the "inline single-UKI"
vehicle from docs/tpm-enrolment-design.md. A production (secure) UKI now
auto-enrols a fresh host with no client cert, then reboots into the normal
secure path.

New dracut hook files/dracut/95dot1x-macsec/tpm-enrol.sh (initqueue/settled
prio 25, BEFORE dot1x-macsec-up at 30):
  - no-op when a cert is already present in NV 0x01800001 (normal boot) or
    under rd.dot1x=0 (test path has no trustworthy identity to enrol);
  - on EMPTY NV: generate the signing key in the TPM @0x81010001 (openssl tpm2
    provider builds the CSR; key never leaves the TPM), pre-auth DHCP on the
    PHYSICAL NIC (nmcli re-manages en*, overriding the secure-mode unmanaged
    drop-in), POST CSR+context to rd.fleet.enrol_url, show the broker
    fingerprint on Plymouth, poll /status, write the issued leaf cert (DER) to
    NV, and reboot to converge.
  - Empty-NV and the secure path are mutually exclusive, so this never reorders
    the load-bearing boot sequence (invariant #2).

Wiring:
  - module-setup.sh: require+install the tpm2 key-gen/NV tools, curl, awk, and
    the openssl tpm2 PROVIDER (ossl-modules/tpm2.so, asserted present — tpm2-tss
    alone can't sign with a handle: key); install the hook.
  - diskless.pkr.hcl: install tpm2-openssl + curl; assert hook/tools/provider in
    the initramfs (invariant #9). New enrol_url var threaded to extract-artifacts.
  - extract-artifacts.sh: bake rd.fleet.enrol_url into the cmdline.
  - fleet.script: enrol-active/enrol-wait/enrol-done banner; fingerprint on the
    message line (public — states only, invariant #1).

Shell JSON build/parse/cert-extract pipeline (no jq in the initramfs) verified
end-to-end against a live broker. BENCH-VERIFY list in docs/TODO.md #11 (tpm2
provider key-ref on real/swtpm, empty-NV detect, pre-auth DHCP override, Plymouth
render, NV write + reboot convergence, prod HTTPS).
2026-07-02 09:00:18 +00:00
Audiobuzz a370f80332 TODO #11: step signer re-verified on the serving host (720h claim, chain) 2026-07-02 08:45:30 +00:00
Audiobuzz 8376f9a92e enrol-broker: run in serving stack + fix step signer path end-to-end
Verifying the step signer against a real step-ca surfaced two real bugs the
mock signer had hidden, plus made the bench CA actually initialise:

- signer.go: move --not-after from `step ca token` (validity caps ~1h ->
  "token validity too long") to `step ca sign` (it is the CERT lifetime).
  Without this the step signer never issues a cert.
- dot1x-bench compose: DOCKER_STEPCA_INIT_PASSWORD_FILE pointed at a file that
  does not exist at first init (it is an INPUT path), so `step ca init` failed
  and never wrote secrets/password. Use DOCKER_STEPCA_INIT_PASSWORD (the value)
  which the entrypoint writes to secrets/password, where bootstrap + broker read.
- bootstrap.sh: self-heal the root-owned ./pki Docker auto-creates; detect the
  CA password at $STEPPATH/password or secrets/password (varies by image
  version); raise authority.claims.maxTLSCertDuration so 720h fleet certs are
  allowed (stock cap 24h, which also blocked bootstrap's own RADIUS cert); fix
  RADIUS cert paths to write via the /export mount (were host paths run inside
  the container, so they never resolved).

- serving stack: add the enrol-broker service (temporary home; nginx already
  proxies /enrol/) defaulting to the zero-dependency lab path (mock signer +
  insecure loopback admin), with ENROL_* knobs to switch to step + mTLS.
- verify-serving.sh: exercise request -> approve -> cert through the deployed
  nginx /enrol/ proxy.
- TODO #11: record the step-signer verification + the two fixes.

Step signer VERIFIED end-to-end against a real step-ca: issued cert chains to
the fleet root, EKU clientAuth, hostnqn derived from serial.
2026-07-02 08:35:35 +00:00
Audiobuzz 9e1dbd3ef7 initial tpm broker 2026-06-28 10:33:14 +00:00
Audiobuzz 3bcf16e384 Merge remote-tracking branch 'origin/main' into tpm-enroll 2026-06-28 18:32:39 +09:30
Audiobuzz 5232b36614 tpm design 2026-06-28 18:32:36 +09:30
Audiobuzz bc14b8986d fixing final SPDK deployment 2026-06-28 08:44:49 +00:00
Audiobuzz 2cf7ad4ffb Apply chromium policy hardening 2026-06-28 03:18:54 +00:00
Audiobuzz ad6b7e3366 Add Host API and fix kiosk performance 2026-06-28 03:14:25 +00:00
Audiobuzz 02ffd7d885 Adding spdk loader 2026-06-27 10:44:42 +00:00
Audiobuzz e43112b0f1 Permanent SPDK trial 2026-06-27 19:29:19 +09:30
Audiobuzz ce5af959ad Add SIEM 2026-06-27 08:52:17 +00:00
Audiobuzz c3507cda6e Update SSP 2026-06-25 23:46:42 +00:00
Audiobuzz dea7ca451a Adding dot1x support 2026-06-22 20:50:48 +00:00
Audiobuzz 3226a44d5a Refactor dnsmasq to build as a container. Add signed iPXE image build 2026-06-21 09:11:23 +00:00
Audiobuzz d2b2156a22 Fixed the secure boot enrollment script 2026-06-20 12:16:37 +00:00
Audiobuzz fb69068980 Update pxe boot flow 2026-06-20 09:17:05 +00:00
Audiobuzz e3978bb210 Add secure boot helper 2026-06-20 06:04:04 +00:00
Audiobuzz ec92417312 Initial Secure boot setup 2026-06-20 00:40:59 +00:00
Audiobuzz b67a23e718 Tightening Stig hardening 2026-06-20 00:05:19 +00:00
Audiobuzz 98c71474d3 Add fleet hostnaming 2026-06-19 09:59:49 +00:00
Audiobuzz 13ac648267 adding secure rsyslog exceptions 2026-06-19 05:01:32 +00:00
Audiobuzz 77416a8e37 Fix fapolicyd for kiosk 2026-06-19 04:21:15 +00:00
Audiobuzz bc8247b410 Add audit log sending 2026-06-19 00:20:34 +00:00
Audiobuzz 6608818902 Fix stig over hardening of kiosk account 2026-06-18 13:28:01 +00:00
Audiobuzz 3b776dd970 Add app 2026-06-18 12:03:45 +00:00
Audiobuzz ada4aa4b18 Add STIG hrdening 2026-06-18 10:00:41 +00:00
Audiobuzz a53357216d Add ntp time source and browser policy 2026-06-18 09:35:58 +00:00
Audiobuzz 838ffd600b Lock down chromium policy 2026-06-17 22:52:18 +00:00
Audiobuzz 3ef34745c9 Adding Plymouth 2026-06-17 14:28:27 +00:00
Audiobuzz 55aa517976 Network Manager refactor 2026-06-17 13:40:28 +00:00
Audiobuzz 4b0e0135b3 Fix kiosk mode 2026-06-17 13:20:52 +00:00
Audiobuzz fd84ba4180 Turn off kiosk by default 2026-06-17 12:44:07 +00:00
Audiobuzz 0bcf6fb2aa Update kiosk to use weston 2026-06-17 09:32:59 +00:00
Audiobuzz 61088d4e6d Add kiosk 2026-06-16 20:38:26 +00:00
Audiobuzz d331ff5589 Fix user ownership bug 2026-06-16 12:23:16 +00:00
Audiobuzz a2e0a3af62 stripping ssh host keys from build 2026-06-16 12:18:48 +00:00
Audiobuzz df27be40f1 Change to a non-root account with ssh key 2026-06-16 11:12:23 +00:00
Audiobuzz 450a989d4e maintain selinux attributes into the erofs build 2026-06-15 21:45:59 +00:00
Audiobuzz 72d3f49369 split out hash because rocky doesnt support it inline 2026-06-15 12:52:27 +00:00
Audiobuzz 2037531771 Add debug to packer build 2026-06-15 12:02:50 +00:00
Audiobuzz e44dd15267 Fix stuff 2026-06-15 10:52:43 +00:00
Audiobuzz 62e49e6b42 pivot to a systemd unit for the online hook 2026-06-15 08:52:19 +00:00
Audiobuzz 2eefd97c50 Fix missing online hook 2026-06-14 21:50:38 +00:00
Audiobuzz a508dce5cf Fix missing online hook 2026-06-14 13:11:10 +00:00