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>
This commit is contained in:
39 files changed
+229
-342
No files matched your search
+4
-4
@@ -1,6 +1,6 @@
|
||||
# Root update
|
||||
# /usr update
|
||||
#
|
||||
# Writes the next version of the root filesystem to the unused root partition.
|
||||
# Writes the next version of /usr to the unused /usr partition.
|
||||
# Verify=yes: SHA256SUMS.gpg must be signed by a key in
|
||||
# /usr/lib/systemd/import-pubring.pgp, and SHA256SUMS checks each download.
|
||||
# The files come from .gitea/workflows/os.yml.
|
||||
@@ -11,12 +11,12 @@ Verify=yes
|
||||
[Source]
|
||||
Type=url-file
|
||||
Path=https://git.plabble.org/api/packages/Job79/generic/agent/latest/
|
||||
MatchPattern=agent_@v.root-%a.@u.raw.zst
|
||||
MatchPattern=agent_@v.usr-%a.@u.raw.zst
|
||||
|
||||
[Target]
|
||||
Type=partition
|
||||
Path=auto
|
||||
MatchPattern=agent_@v
|
||||
MatchPartitionType=root
|
||||
MatchPartitionType=usr
|
||||
PartitionFlags=0
|
||||
ReadOnly=1
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
# Root verity update
|
||||
# /usr verity update
|
||||
#
|
||||
# Writes the dm-verity hashes that go with 10-root.transfer, which explains
|
||||
# Writes the dm-verity hashes that go with 10-usr.transfer, which explains
|
||||
# Verify=yes.
|
||||
[Transfer]
|
||||
ProtectVersion=%A
|
||||
@@ -9,12 +9,12 @@ Verify=yes
|
||||
[Source]
|
||||
Type=url-file
|
||||
Path=https://git.plabble.org/api/packages/Job79/generic/agent/latest/
|
||||
MatchPattern=agent_@v.root-%a-verity.@u.raw.zst
|
||||
MatchPattern=agent_@v.usr-%a-verity.@u.raw.zst
|
||||
|
||||
[Target]
|
||||
Type=partition
|
||||
Path=auto
|
||||
MatchPattern=agent_@v_verity
|
||||
MatchPartitionType=root-verity
|
||||
MatchPartitionType=usr-verity
|
||||
PartitionFlags=0
|
||||
ReadOnly=1
|
||||
@@ -1,12 +1,12 @@
|
||||
# UKI update
|
||||
#
|
||||
# Installs the next UKI, which systemd-boot then boots by default. For
|
||||
# Verify=yes, see 10-root.transfer.
|
||||
# Verify=yes, see 10-usr.transfer.
|
||||
#
|
||||
# The new UKI gets three tries (boot counting: the +@l-@d in its name).
|
||||
# systemd-bless-boot marks it good once a boot reaches boot-complete.target.
|
||||
# If no boot does, systemd-boot goes back to the previous UKI, and with it to
|
||||
# the previous root partition, because each UKI holds its root hash. No
|
||||
# the previous /usr partition, because each UKI holds its usr hash. No
|
||||
# Mode=0444: systemd-boot can't rename a read-only file.
|
||||
[Transfer]
|
||||
ProtectVersion=%A
|
||||
|
||||
Reference in new issue
Block a user