Skip to content

K2GO-549 fix(rootfs): ship no per-box secrets; the box makes them at first start - #742

Merged
luisguzman-adfa merged 7 commits into
mainfrom
fix/K2GO-549-bake-strips-box-secrets
Nov 6, 2026
Merged

luisguzman-adfa merged 7 commits into
mainfrom
fix/K2GO-549-bake-strips-box-secrets

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

What changes

  • The rootfs bake strips the per-box secrets and IDs after the install: the Forgejo secrets and JWT signing keys, the Calibre-Web keys, the Kolibri facility root key, machine-id and the IIAB uuid.
  • New static/box-identity/k2go_box_identity.py (stdlib only) is the one list of these values. --strip removes them in the bake. With no argument, it runs at each box start and makes only the missing values. It never changes a present value, uses no marker file, and never prints a value.
  • New one-shot PDSM entry 00-k2go-box-identity runs the step before any service starts (pdsm starts entries in lexical order). If the step fails, the box still starts.
  • iiab-android installs and enables the step. On a device install, the roles already made the values, so the step has nothing to do.
  • build-iiab-rootfs.sh: six new checks fail the bake if a secret ships or the step is not enabled.

Why

  • The published rootfs is public, so every box shared the secrets of the CI bake. Anyone with the tarball could sign a Kolibri facility certificate and pull or push all learner data on the LAN with no password. A controlled test confirmed this.

Verifications

  • OnePlus, sandbox copy of a full rootfs: strip 22 s, nothing per-box left. First start 19-34 s, all values made fresh. Second start 1 s, no change. Kolibri and Forgejo login work.
  • The Kolibri facility key, Forgejo secrets and Calibre-Web key differ from the published image after the first start.
  • Coordination: boxes already installed keep the shared values. This change protects new installs only. Guidance for existing boxes: export content, delete, install a clean rootfs.
  • Deferred: end-to-end check on a dev-channel bake. Behavior when Kolibri provisiondevice fails. First-start time on a slow phone against the app's 45 s start wait.

Notes

  • Detail of the Morango test and the per-app audit: K2GO-549.

…first start

The published rootfs carried the Forgejo secrets and signing keys, the Calibre-Web
keys, the Kolibri facility root key, machine-id and the IIAB uuid of the CI bake,
so every box shared them. The bake now strips them, and a one-shot PDSM entry makes
the missing ones on the box before the services start.
Match the Kolibri pid by its command line, drop a stale pid before deprovision,
read quoted IIAB vars, limit Forgejo secrets to the generate-secret kinds, and
check the strip against the app.ini paths.
If first-start provisioning fails, its setup wizard would let any network client
create the superuser. The pdsm kolibri start now checks Kolibri's own provisioned
flag and stays down; the next box start provisions again.
A killed run can leave a read-only temp file (machine-id is 0444) that a non-root
app uid cannot truncate, so every later start failed for that item.
The installer and its /opt/iiab-android clone came from main, so a branch bake
did not test the branch. The builder takes --k2go-ref (default main); test and
dev dispatches pass their branch, publish keeps main.
The app kills a booting box after 60 s with no output. Kolibri provisioning on a slow phone can be longer, so each run prints a line every 10 s.
…eneration

The app shows a boot screen while the box makes its per-box values. A start that makes nothing prints neither line.
@luisguzman-adfa
luisguzman-adfa merged commit b5f143c into main Nov 6, 2026
8 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the fix/K2GO-549-bake-strips-box-secrets branch November 6, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant