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
@@ -0,0 +1,18 @@
|
||||
# Root filesystem
|
||||
#
|
||||
# systemd-repart makes it in the initrd at first boot, from the free space
|
||||
# after /usr, and grows it when the disk grows. It holds all state: /etc
|
||||
# (mkosi.finalize) and /var, which is its own btrfs subvolume. It is encrypted
|
||||
# with a key in the TPM, so a TPM is required. The key is sealed to the signed
|
||||
# PCR 11 policy of our UKIs (SignExpectedPcr= in mkosi.conf), and the initrd
|
||||
# unlocks it at every boot.
|
||||
#
|
||||
# FactoryReset makes a factory reset wipe it: root runs systemctl start
|
||||
# factory-reset.target, and at the next boot it is made anew, as at first boot.
|
||||
[Partition]
|
||||
Type=root
|
||||
Format=btrfs
|
||||
Subvolumes=/var
|
||||
MakeDirectories=/var
|
||||
Encrypt=tpm2
|
||||
FactoryReset=yes
|
||||
Reference in new issue
Block a user