Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Release signing: Ed25519 release key (public half in tools/release and the installer), sign-release.sh, docs

Federico Pereira99b50cf3c18a
diff --git a/docs/INSTALL-DEBIAN.md b/docs/INSTALL-DEBIAN.md
index 8020fec..b70cada 100644
--- a/docs/INSTALL-DEBIAN.md
+++ b/docs/INSTALL-DEBIAN.md
@@ -35,10 +35,10 @@ this works even though the script itself comes through a pipe.
release is looked up through the GitHub API; since betas are marked as pre-releases, which
`releases/latest` skips, it falls back to the newest release of any kind.
3. **Verifies** the `.deb`'s SHA-256 against `SHA256SUMS`. A mismatch stops everything.
- - **Signature:** LordOS has no release-signing key yet, so `SHA256SUMS` itself is not signed.
- The installer says so in its output: the checksum catches a corrupted download, not a
- tampered release. The Ed25519 check is already written and switches on once the key is added
- (`SIGNING.md`, "Release files").
+ - **Signature:** before downloading the `.deb`, it checks `SHA256SUMS.sig`, the Ed25519
+ signature of `SHA256SUMS` made with the LordOS release key (fingerprint
+ `c7155b8e…53ea108e`, see `SIGNING.md`, "Release files"). A missing or invalid signature
+ stops the install.
4. **Installs** with `apt-get install ./lordos_<version>_<arch>.deb`, so the dependencies come from
your Debian mirrors. It also installs, if they are missing, what the ISO adds for sound, fonts
and the user session (`dbus-user-session`, PipeWire with `pipewire-pulse`, `pipewire-alsa` and
diff --git a/docs/SIGNING.md b/docs/SIGNING.md
index dccd1c1..ad328b7 100644
--- a/docs/SIGNING.md
+++ b/docs/SIGNING.md
@@ -121,30 +121,30 @@ one, the **development** key:
For a public release, the final key is added to `keys.h` and the development one is removed.
-### Release files (not signed yet)
-
-The GitHub release files (the `.deb`, the ISO, the Raspberry Pi image) are listed with their
-SHA-256 in `SHA256SUMS`. The Debian installer (`tools/install/install.sh`, see
-`INSTALL-DEBIAN.md`) always checks the `.deb` against it. **`SHA256SUMS` itself is not signed
-yet**, so that check catches corrupted downloads but not a tampered release page; the installer
-says so in its output.
-
-The verification side is already in the installer, waiting for a key:
-
-- `SHA256SUMS.sig` = base64 of the 64-byte Ed25519 signature over the exact bytes of `SHA256SUMS`;
-- the public key goes in `RELEASE_PUBKEY_PEM` in `install.sh` (PEM, as OpenSSL 3 reads it). From a
- raw hex key like `packaging/keys/lordos-dev.pub`:
- `printf '302a300506032b6570032100%s' "$(cat key.pub)" | xxd -r -p | openssl pkey -pubin -inform DER`;
-- when the key is set, a missing or invalid signature stops the install before the `.deb` is
- downloaded (tested with a throwaway key through `LORDOS_PUBKEY_FILE`, a test-only override).
-
-TODO(release-signing), before the first public release:
-
-1. Generate the release key offline and keep the private half off the build VMs.
-2. Sign: `openssl pkeyutl -sign -rawin -inkey release.key.pem -in SHA256SUMS | base64 -w0 > SHA256SUMS.sig`,
- and upload `SHA256SUMS.sig` with the release.
-3. Put the public key in `RELEASE_PUBKEY_PEM`, and publish its fingerprint on the website and in
- the README, so people who download the ISO by hand can check `SHA256SUMS.sig` too.
+### Release files
+
+Every GitHub release file (the `.deb`, the ISO, the Raspberry Pi image) is listed with its SHA-256
+in `SHA256SUMS`, and `SHA256SUMS` is signed with the LordOS release key:
+
+- `SHA256SUMS.sig` = base64 of the 64-byte Ed25519 signature over the exact bytes of `SHA256SUMS`.
+- Public key: `tools/release/lordos-release.pub.pem`, also embedded as `RELEASE_PUBKEY_PEM` in
+ `tools/install/install.sh`.
+- Fingerprint (SHA-256 of the DER public key):
+ `c7155b8e6bbbb180f907381994d06af76d333016cd6f3facf67cadd053ea108e`
+- Signing: `tools/release/sign-release.sh <release-dir>` writes `SHA256SUMS` and `SHA256SUMS.sig`
+ and checks the result against the public key. The private key lives only on the maintainer's
+ machine (`~/.config/lordos-release/release-ed25519.key.pem`, mode 0600), never in the repository
+ or on a build VM. Keep an offline backup of it.
+- The Debian installer refuses to install when the signature is missing or invalid, before the
+ `.deb` is downloaded.
+
+Checking a download by hand (OpenSSL 3):
+
+```sh
+base64 -d SHA256SUMS.sig > SHA256SUMS.sig.bin
+openssl pkeyutl -verify -pubin -inkey lordos-release.pub.pem -rawin -in SHA256SUMS -sigfile SHA256SUMS.sig.bin
+sha256sum -c --ignore-missing SHA256SUMS
+```
## Files
diff --git a/tools/install/install.sh b/tools/install/install.sh
index 491d6e3..9277ae6 100755
--- a/tools/install/install.sh
+++ b/tools/install/install.sh
@@ -31,9 +31,11 @@ LOCALES="en_US.UTF-8 es_ES.UTF-8 pt_BR.UTF-8"
KNOWN_DMS="gdm3 gdm sddm lightdm lxdm xdm slim nodm greetd ly"
# Ed25519 public key that signs SHA256SUMS (SHA256SUMS.sig = base64 of the 64-byte signature).
-# TODO(release-signing): LordOS has no release-signing key yet (docs/SIGNING.md, "Release files").
-# While this is empty only the SHA-256 checksum is verified, and the installer says so.
-RELEASE_PUBKEY_PEM=""
+# Fingerprint (SHA-256 of the DER key): c7155b8e6bbbb180f907381994d06af76d333016cd6f3facf67cadd053ea108e
+# See docs/SIGNING.md, "Release files". A missing or invalid signature stops the install.
+RELEASE_PUBKEY_PEM="-----BEGIN PUBLIC KEY-----
+MCowBQYDK2VwAyEA8cqwDzH+ZVMdBqNjC3141dmo3gcH8PWt88I+RE9dOaA=
+-----END PUBLIC KEY-----"
# ---------------------------------------------------------------- output
diff --git a/tools/release/lordos-release.pub.pem b/tools/release/lordos-release.pub.pem
new file mode 100644
index 0000000..0e33ab7
--- /dev/null
+++ b/tools/release/lordos-release.pub.pem
@@ -0,0 +1,3 @@
+-----BEGIN PUBLIC KEY-----
+MCowBQYDK2VwAyEA8cqwDzH+ZVMdBqNjC3141dmo3gcH8PWt88I+RE9dOaA=
+-----END PUBLIC KEY-----
diff --git a/tools/release/sign-release.sh b/tools/release/sign-release.sh
new file mode 100755
index 0000000..47f2e12
--- /dev/null
+++ b/tools/release/sign-release.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Signs a LordOS release folder: writes SHA256SUMS (every release file) and SHA256SUMS.sig
+# (base64 of the Ed25519 signature over the exact bytes of SHA256SUMS), then verifies it
+# against tools/release/lordos-release.pub.pem.
+#
+# tools/release/sign-release.sh <release-dir> [private-key.pem]
+#
+# The private key never enters the repository or a build VM. Default location:
+# ~/.config/lordos-release/release-ed25519.key.pem (mode 0600) on the maintainer's machine.
+set -eu
+dir=${1:?usage: sign-release.sh <release-dir> [private-key.pem]}
+key=${2:-$HOME/.config/lordos-release/release-ed25519.key.pem}
+here=$(cd "$(dirname "$0")" && pwd)
+pub=$here/lordos-release.pub.pem
+[ -r "$key" ] || { echo "no private key at $key" >&2; exit 1; }
+command -v openssl >/dev/null || { echo "openssl is needed" >&2; exit 1; }
+cd "$dir"
+rm -f SHA256SUMS SHA256SUMS.sig
+files=$(find . -maxdepth 1 -type f ! -name 'SHA256SUMS*' ! -name '.*' | sed 's|^\./||' | LC_ALL=C sort)
+[ -n "$files" ] || { echo "no files in $dir" >&2; exit 1; }
+if command -v sha256sum >/dev/null; then sum() { sha256sum "$@"; }; else sum() { shasum -a 256 "$@"; }; fi
+# shellcheck disable=SC2086
+sum $files > SHA256SUMS
+openssl pkeyutl -sign -rawin -inkey "$key" -in SHA256SUMS | base64 | tr -d '\n' > SHA256SUMS.sig
+echo >> SHA256SUMS.sig
+base64 -d < SHA256SUMS.sig > SHA256SUMS.sig.bin 2>/dev/null || base64 -D < SHA256SUMS.sig > SHA256SUMS.sig.bin
+openssl pkeyutl -verify -pubin -inkey "$pub" -rawin -in SHA256SUMS -sigfile SHA256SUMS.sig.bin >/dev/null
+rm -f SHA256SUMS.sig.bin
+echo "signed $(wc -l < SHA256SUMS | tr -d ' ') files in $dir (SHA256SUMS + SHA256SUMS.sig), signature verified"