Files
agentos/.gitea/workflows/os.yml
T
Job79andClaude Opus 5.5 c80e843cb5 feat: ParticleOS-like layout: /usr image, encrypted btrfs root
The image now holds only the ESP and a verity-protected /usr (A/B). At
first boot, systemd-repart in the initrd makes the root filesystem: btrfs,
encrypted with a TPM key sealed to the signed PCR 11 policy, with /var as
its own subvolume. A TPM is required. systemd.image_policy= accepts only
an encrypted root and a verity-checked /usr, and FactoryReset=yes lets
factory-reset.target wipe it.

/etc is writable but nearly empty: mkosi.finalize keeps the build's /etc
in /usr/share/factory/etc and systemd-tmpfiles links it in at boot. That
removes etc-shadow.mount, the host key on /var, fstab and /var/lib/agent.
/var now survives reboots.

systemd-firstboot replaces agent-setup: it asks for the root password on
the screen and offers a recovery key. Machines are named agent-???? from
the kernel command line. The user is now agent, with its home in
/home/agent and ssh keys in the default places. sshd.path starts sshd
only once root or agent has a key.

The test VM needs swtpm. The package cache moves to a podman volume
(AGENTS.md). No existing VMs can update to this layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:09:31 +01:00

61 lines
2.1 KiB
YAML

# OS image
#
# Builds the OS image and publishes it as version "latest". VMs fetch the
# built images as updates (mkosi.extra/usr/lib/sysupdate.d). Runs on every
# push, weekly for package updates, and by hand for critical CVEs.
#
# Required values:
# - SECUREBOOT_KEY repository secret: the private key of mkosi.crt, written
# to mkosi.key.
# - SIGNING_KEY repository secret: the armored private gpg key whose
# public half is mkosi.extra/usr/lib/systemd/
# import-pubring.pgp, which systemd-sysupdate checks.
name: os
on:
push:
branches: [main]
schedule:
- cron: "0 2 * * 0"
workflow_dispatch:
jobs:
os:
runs-on: linux
env:
PKG: ${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/agent/latest
AUTH: "Authorization: token ${{ gitea.token }}"
steps:
- name: Install tools
run: dnf install -yq mkosi sbsigntools
- name: Check out
uses: builtin:checkout
- name: Build
env:
KEY: ${{ secrets.SECUREBOOT_KEY }}
run: |
(umask 077 && printf '%s\n' "$KEY" > mkosi.key)
mkosi build
- name: Compress
working-directory: mkosi.output
run: |
zstd -q --rm -9 agent_*.usr-*.raw
- name: Sign
working-directory: mkosi.output
env:
KEY: ${{ secrets.SIGNING_KEY }}
run: |
sha256sum agent_*.efi agent_*.usr-*.raw.zst > SHA256SUMS
export GNUPGHOME=$(mktemp -d)
gpg -q --batch --import <<< "$KEY"
gpg -q --batch -o SHA256SUMS.gpg --detach-sign SHA256SUMS
- name: Build qcow2
working-directory: mkosi.output
run: qemu-img convert -c -O qcow2 "$(basename agent_*.efi .efi).raw" agent.qcow2
- name: Publish
working-directory: mkosi.output
run: |
curl -fsS -H "$AUTH" -X DELETE "$PKG" || true
for f in agent_*.efi agent_*.usr-*.raw.zst agent.qcow2 agent_*.manifest SHA256SUMS.gpg SHA256SUMS; do
curl -fsS -o /dev/null -H "$AUTH" --upload-file "$f" "$PKG/$f"
done