1 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 e85e85d075 build(cosign): the units, install.sh and the co-signer's docs
- [email protected], a template: devvm-cosign@run for the timer, and
  @check and @init for setting up. The keys are root's, mode 0600, and
  reach the service only as systemd's credentials (LoadCredential=), in
  a folder of its own while it runs; the base's key comes from a drop-in,
  devvm-cosign-base.conf, which install.sh installs once there is one, as
  a credential that isn't there fails the service. Its processes are in
  a PID namespace of their own (PrivatePIDs=), and any failure starts
  devvm-cosign-failed.service (OnFailure=).
- devvm-cosign-podman.service, where a process that escapes a build's
  container lands: a PID namespace of its own, so no other process's
  /proc/<pid>/root; the config, the keys, every service's credentials and
  the whole state folder inaccessible; its HOME, with podman's config and
  storage, and its only writable folder, the build folder,
  /var/lib/devvm-cosign-build; StopWhenUnneeded=, so it runs only while
  a run needs it; each start deletes the whole build folder, podman's
  config first, then its images and containers (podman system reset),
  then the rest, so nothing a build left, a link or a config pointing
  podman at another runtime, reaches the next; and OnFailure=, as a run
  whose podman fails to start doesn't fail itself.
- devvm-cosign-failed.service runs devvm-cosign failed, which tells the
  maintainer through the config's notify command, reading no key.
- devvm-cosign.timer starts devvm-cosign@run hourly.
- install.sh: 65536 subordinate IDs from the first multiple of 65536
  above every range another user has in /etc/subuid or /etc/subgid, so
  no two users' containers share an ID; the state folder and the build
  folder, with the folders the units need; the config readable by the
  co-signer's group, for retry and ack; the old devvm-cosign.service
  removed.
- Docs: contributing/cosigner.md for the new flow: what CI hands over,
  what a run does (the old step 8 split into the draft, the publish and
  the check after), refusals and alerts, retry, ack and notify through
  OnFailure (HTTPS, not a local sendmail, under NoNewPrivileges), the
  base's snapshot bound and why, its files, the config's new keys and
  the credentials' names and modes, the setup with the Go the tag's
  mise.lock pins (mise exec), the units, what a build's container can
  reach and what's still shared (the user and the machine: an escape can
  slow or change the build it's in, which then doesn't match, and use
  the network while that run lasts; a kernel escape gets past it all),
  the GitHub App's Actions: read and the tap ruleset's bypass, that the
  units name the folders, and moving machines by copying
  /var/lib/devvm-cosign but stage/, src/ and cache/. maintaining.md's
  Release keys say who publishes, as it is; structure.md's package row;
  the 0.2.0 page and the changelog line.

Validated on Fedora 43 (SELinux enforcing, podman 5.6, systemd 258), in
a throwaway Lima VM: install.sh, then check, init and a run under these
units with rootless podman, against the fake GitHub over TLS with a
throwaway v9.9.9 and throwaway keys. CI's build was release.sh --tag
under rootless podman, handed over as an artifact; the co-signer cloned
its root-owned checkout, rebuilt, matched, signed, made the release,
published it and wrote both formulas, the same bytes as CI's build's.
Both signatures verified with minisign, every file with SHA256SUMS, the
podman unit stopped after the run, and a second run did nothing. During
the build, from the podman service's namespaces as the co-signer's
user: only the build's own processes were there, so release.sh's and
the run's /proc/<pid>/root weren't; the state folder, the clone
release.sh ran from and CI's staged files were refused; and only the
build folder was writable; only SHA256SUMS and CI's signature were
staged; and the build's finished files and the download cache were in
the state folder. A second start of the podman service reset the last
build's images and containers and left an empty build folder. A run
failed with GitHub gone started devvm-cosign-failed, whose notify got
the recorded failure, and a podman start that failed started it too. The first
runs found three things the fake can't, fixed in the earlier commits:
podman needs ~/.config, which install.sh now makes; system credentials
are mode 0440 with an ACL; and the clone needs the checkout's .git named
safe.

The podman service's first ExecStartPre deletes the co-signer's user's
/dev/shm/libpod* files, podman's locks, which outlive the service and no
folder it empties holds (TestPodmanUnitStartsClean). cosigner.md also
covers a build that keeps failing and GitHub's latest release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00