From d76d28ef8a72a692e02f8e926471118b7c04f316 Mon Sep 17 00:00:00 2001 From: Job Date: Mon, 23 Nov 2026 18:28:04 +0000 Subject: [PATCH] Sign local builds with mkosi -f genkey It replaces mkosi.crt for local tests, without openssl or a mkosi.local.conf. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 - AGENTS.md | 3 +-- README.md | 22 ++-------------------- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 92d2379..955d80d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ mkosi.key mkosi.output/ mkosi.cache/ -mkosi.local.conf mkosi.credentials/ diff --git a/AGENTS.md b/AGENTS.md index 8c39bab..4441249 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -66,14 +66,13 @@ CMD ["/sbin/init"] END podman run -d --name mkosi --privileged --systemd=always -v :/repo \ -v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm +podman exec mkosi mkosi -f genkey # Run this once. Don't commit mkosi.crt. podman exec mkosi mkdir -p mkosi.cache podman exec -d -t mkosi sh -c 'mkosi -i -f --kernel-command-line-extra="\ console=ttyS0 systemd.journald.forward_to_console=1" vm -- \ -serial chardev:console > mkosi.output/vm.log 2>&1' ``` -- mkosi signs with the test key of `mkosi.local.conf` - ([README.md](README.md#development)), with paths as the container sees them. - To register the test VM, register on the host with `gitea-runner register --no-interactive --instance --token ` and pass the `.runner` it writes as a tmpfiles.extra credential: diff --git a/README.md b/README.md index e2858d0..79d2c78 100644 --- a/README.md +++ b/README.md @@ -38,29 +38,11 @@ at first boot. ## Development -`mkosi build` signs with `mkosi.key`, the private key of `mkosi.crt`, which -only CI has (the `SECUREBOOT_KEY` secret). `mkosi genkey` won't replace -`mkosi.crt`, so local builds sign with a test key. Make one: - ```sh -openssl req -new -x509 -newkey rsa:2048 -nodes -subj /CN=test \ - -keyout ~/test.key -out ~/test.crt +mkosi -f genkey # This replaces mkosi.crt for local tests. Don't commit it. +mkosi build ``` -and point `mkosi.local.conf` at it, which mkosi reads and git ignores: - -```ini -[Validation] -SecureBootKey=~/test.key -SecureBootCertificate=~/test.crt -SignExpectedPcrKey=~/test.key -SignExpectedPcrCertificate=~/test.crt -VerityKey=~/test.key -VerityCertificate=~/test.crt -``` - -Then run `mkosi build`. - `mkosi.output/` then holds the disk image (`runneros_.raw`) and the UKI and /usr partitions that make up an update. To boot a test VM, see [AGENTS.md](AGENTS.md#testing).