Sign updates
The os workflow signs SHA256SUMS with the SIGNING_KEY secret and publishes SHA256SUMS.gpg next to it. systemd-sysupdate now verifies it (Verify=yes) against import-pubring.pgp, so hosts only install updates we built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+21
-9
No files matched your search
+10
-1
@@ -31,11 +31,20 @@ jobs:
|
|||||||
zstd -q --rm -T0 -19 git-runner_*.root-*.raw
|
zstd -q --rm -T0 -19 git-runner_*.root-*.raw
|
||||||
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
|
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
|
||||||
sha256sum git-runner_*.efi git-runner_*.root-*.raw.zst > SHA256SUMS
|
sha256sum git-runner_*.efi git-runner_*.root-*.raw.zst > SHA256SUMS
|
||||||
|
# Signs SHA256SUMS with the key whose public half is mkosi.extra/usr/lib/systemd/import-pubring.pgp.
|
||||||
|
- name: Sign
|
||||||
|
working-directory: mkosi.output
|
||||||
|
env:
|
||||||
|
KEY: ${{ secrets.SIGNING_KEY }}
|
||||||
|
run: |
|
||||||
|
export GNUPGHOME=$(mktemp -d)
|
||||||
|
gpg -q --batch --import <<< "$KEY"
|
||||||
|
gpg -q --batch -o SHA256SUMS.gpg --detach-sign SHA256SUMS
|
||||||
# Replaces the previous version. SHA256SUMS goes last: until it's there, runners find no update.
|
# Replaces the previous version. SHA256SUMS goes last: until it's there, runners find no update.
|
||||||
- name: Publish
|
- name: Publish
|
||||||
working-directory: mkosi.output
|
working-directory: mkosi.output
|
||||||
run: |
|
run: |
|
||||||
curl -fsS -H "$AUTH" -X DELETE "$PKG" || true
|
curl -fsS -H "$AUTH" -X DELETE "$PKG" || true
|
||||||
for f in $(awk '{print $2}' SHA256SUMS) git-runner.qcow2 SHA256SUMS; do
|
for f in git-runner_*.efi git-runner_*.root-*.raw.zst git-runner.qcow2 SHA256SUMS.gpg SHA256SUMS; do
|
||||||
curl -fsS -o /dev/null -H "$AUTH" --upload-file "$f" "$PKG/$f"
|
curl -fsS -o /dev/null -H "$AUTH" --upload-file "$f" "$PKG/$f"
|
||||||
done
|
done
|
||||||
@@ -5,7 +5,7 @@ A [Gitea Actions](https://docs.gitea.com/usage/actions/overview) runner packaged
|
|||||||
- **Small:** Fedora with podman, networking and zram swap, for VMs only: no firmware or drivers for real hardware, no package manager or sshd. About 300 MB of RAM idle; boots in 512 MB.
|
- **Small:** Fedora with podman, networking and zram swap, for VMs only: no firmware or drivers for real hardware, no package manager or sshd. About 300 MB of RAM idle; boots in 512 MB.
|
||||||
- **Stateless:** container storage is wiped on every boot.
|
- **Stateless:** container storage is wiped on every boot.
|
||||||
- **Isolated jobs:** each job runs in a container of its own (privileged, so it can build OS images), with its own podman; jobs never get the runner's podman. The job image ships with the OS, and common base images are shared read-only, so jobs don't download them. A job that runs the VM out of memory is killed (systemd-oomd); the runner keeps running.
|
- **Isolated jobs:** each job runs in a container of its own (privileged, so it can build OS images), with its own podman; jobs never get the runner's podman. The job image ships with the OS, and common base images are shared read-only, so jobs don't download them. A job that runs the VM out of memory is killed (systemd-oomd); the runner keeps running.
|
||||||
- **Self-updating:** images are rebuilt weekly and on every push. Hosts download updates with systemd-sysupdate into a second root partition (A/B) and reboot into them daily at about 04:10, after letting running jobs finish.
|
- **Self-updating:** images are rebuilt weekly and on every push. Hosts download updates with systemd-sysupdate, check their signature (the key is the `SIGNING_KEY` secret of this repository), and write them into a second root partition (A/B) and reboot into them daily at about 04:10, after letting running jobs finish.
|
||||||
- **Read-only system:** systemd-boot starts a UKI that mounts the root filesystem, /etc and /usr included, from a read-only erofs partition checked by dm-verity. Updates replace it whole, so nothing drifts. All state (the runner registration, the root password, logs) lives on /var, its own partition.
|
- **Read-only system:** systemd-boot starts a UKI that mounts the root filesystem, /etc and /usr included, from a read-only erofs partition checked by dm-verity. Updates replace it whole, so nothing drifts. All state (the runner registration, the root password, logs) lives on /var, its own partition.
|
||||||
- **Hardened:** a firewall that drops all incoming traffic, and KSPP sysctls and kernel arguments.
|
- **Hardened:** a firewall that drops all incoming traffic, and KSPP sysctls and kernel arguments.
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -24,7 +24,8 @@ Bootable=yes
|
|||||||
ExtraTrees=%O/job:/usr/lib/gitea-runner/job-image
|
ExtraTrees=%O/job:/usr/lib/gitea-runner/job-image
|
||||||
Bootloader=systemd-boot
|
Bootloader=systemd-boot
|
||||||
# - kernel-core no drivers or firmware beyond what VMs need
|
# - kernel-core no drivers or firmware beyond what VMs need
|
||||||
# - systemd-container systemd-pull, which systemd-sysupdate downloads with
|
# - systemd-container, gnupg2 systemd-pull, which systemd-sysupdate downloads with, and gpg,
|
||||||
|
# which it checks their signature with
|
||||||
# - systemd-boot-unsigned the bootloader
|
# - systemd-boot-unsigned the bootloader
|
||||||
# - util-linux, shadow-utils console login and the first-boot setup
|
# - util-linux, shadow-utils console login and the first-boot setup
|
||||||
# - podman, git-core the runner's jobs; git fetches actions
|
# - podman, git-core the runner's jobs; git fetches actions
|
||||||
@@ -38,6 +39,7 @@ Packages=
|
|||||||
systemd-networkd
|
systemd-networkd
|
||||||
systemd-resolved
|
systemd-resolved
|
||||||
systemd-container
|
systemd-container
|
||||||
|
gnupg2
|
||||||
systemd-boot-unsigned
|
systemd-boot-unsigned
|
||||||
util-linux
|
util-linux
|
||||||
shadow-utils
|
shadow-utils
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,9 @@
|
|||||||
# Updates the root filesystem: writes the next version to the unused root partition.
|
# Updates the root filesystem: writes the next version to the unused root partition.
|
||||||
# Verify=no: updates are unsigned (no secrets in the repo); SHA256SUMS still checks each download.
|
# Verify=yes: SHA256SUMS.gpg must be signed by a key in /usr/lib/systemd/import-pubring.pgp, and
|
||||||
|
# SHA256SUMS checks each download.
|
||||||
[Transfer]
|
[Transfer]
|
||||||
ProtectVersion=%A
|
ProtectVersion=%A
|
||||||
Verify=no
|
Verify=yes
|
||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Updates the root filesystem's dm-verity hashes, next to 10-root.transfer (see it for Verify=no).
|
# Updates the root filesystem's dm-verity hashes, next to 10-root.transfer (see it for Verify=yes).
|
||||||
[Transfer]
|
[Transfer]
|
||||||
ProtectVersion=%A
|
ProtectVersion=%A
|
||||||
Verify=no
|
Verify=yes
|
||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Installs the next UKI, which systemd-boot boots by default. Verify=no: see 10-root.transfer.
|
# Installs the next UKI, which systemd-boot boots by default. Verify=yes: see 10-root.transfer.
|
||||||
[Transfer]
|
[Transfer]
|
||||||
ProtectVersion=%A
|
ProtectVersion=%A
|
||||||
Verify=no
|
Verify=yes
|
||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
|
|||||||
Reference in new issue
Block a user