From a5ee20710dd9379b4ee4dd37ba507c512dba29da Mon Sep 17 00:00:00 2001 From: lotherk Date: Mon, 16 Nov 2026 09:58:57 +0000 Subject: [PATCH] signify: a root key signs the release key, the release key signs a release Konrad, 2026-11-16: the master key model. The root key stays offline with Konrad and signs release keys only; the release key (0.99) signs the SHA512 of a release. Rotation is a new release key plus one signature by the root key, not a new root. - src/etc/signify/makronix-root.pub and makronix-0.99.pub.sig are installed next to the release key (etc set, etc-sys-etc); the private root and release keys are outside the tree (SIGNIFY_ROOT_SECKEY, SIGNIFY_SECKEY). - tools/sign-release.sh: sign, verify (checks root -> release key -> file) and sign-key (root signs a new release public key). - GOAL.md names the chain. Measured: sign-key with the root key produces the same Ed25519 signature; verify prints "signed by the root key" and "good signature" for a signed test file. --- GOAL.md | 11 +++++---- src/distrib/sets/lists/etc/mi | 2 ++ src/etc/signify/Makefile | 2 +- src/etc/signify/makronix-0.99.pub.sig | 2 ++ src/etc/signify/makronix-root.pub | 2 ++ tools/sign-release.sh | 34 +++++++++++++++++++++------ 6 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 src/etc/signify/makronix-0.99.pub.sig create mode 100644 src/etc/signify/makronix-root.pub diff --git a/GOAL.md b/GOAL.md index 2afba7a8b0..a1cc3c4d23 100644 --- a/GOAL.md +++ b/GOAL.md @@ -124,10 +124,13 @@ Baum und liegt in `/usr/src`; kein `/usr/xsrc`, kein `/usr/msrc`. Entschieden (Konrad, 2026-11-16), nach Vorlage der offenen Punkte: -- **Update-Signatur:** eigener signify-Schlüssel. Der private Schlüssel - bleibt bei Konrad, offline; der öffentliche liegt als - `/etc/signify/makronix-0.99.pub` im System. `make release` signiert die - `SHA512` der Sets; die Paketliste des Mediums wird im selben Lauf signiert. +- **Update-Signatur:** zwei signify-Schlüssel in einer Kette. Der + **Root-Schlüssel** (`makronix-root.sec`) bleibt offline bei Konrad und + signiert nur die Release-Schlüssel; der **Release-Schlüssel** + (`makronix-0.99.sec`, pro Release bzw. jaehrlich erneuerbar) signiert die + `SHA512` der Sets und die Paketliste des Mediums. Im System liegen + `/etc/signify/makronix-root.pub`, `makronix-0.99.pub` und dessen + Root-Signatur `makronix-0.99.pub.sig`. - **makronix-Set:** die Pakete werden als Binaerpakete aus dem Medium-Repository mit `pkg_add` installiert, nicht als unregistrierte Dateien (dann sehen `pkg_info`, `pkg_add -u` und `pkg_admin audit` sie). diff --git a/src/distrib/sets/lists/etc/mi b/src/distrib/sets/lists/etc/mi index 39fb007538..1b645269e4 100644 --- a/src/distrib/sets/lists/etc/mi +++ b/src/distrib/sets/lists/etc/mi @@ -367,6 +367,8 @@ ./etc/shrc etc-util-etc ./etc/signify etc-sys-etc ./etc/signify/makronix-0.99.pub etc-sys-etc +./etc/signify/makronix-0.99.pub.sig etc-sys-etc +./etc/signify/makronix-root.pub etc-sys-etc ./etc/skel/.cshrc etc-sys-etc ./etc/skel/.login etc-sys-etc ./etc/skel/.logout etc-sys-etc diff --git a/src/etc/signify/Makefile b/src/etc/signify/Makefile index 74e5b00aee..943e62f96f 100644 --- a/src/etc/signify/Makefile +++ b/src/etc/signify/Makefile @@ -8,7 +8,7 @@ .include -CONFIGFILES= makronix-0.99.pub +CONFIGFILES= makronix-root.pub makronix-0.99.pub makronix-0.99.pub.sig FILESDIR= /etc/signify FILESMODE= 644 diff --git a/src/etc/signify/makronix-0.99.pub.sig b/src/etc/signify/makronix-0.99.pub.sig new file mode 100644 index 0000000000..962e1eea94 --- /dev/null +++ b/src/etc/signify/makronix-0.99.pub.sig @@ -0,0 +1,2 @@ +untrusted comment: verify with makronix-root.pub +RWRp581tt5FeS0le4nf4t2ptylyIaUa+nT8JTBvc5hzz6rprNc8mBvYrAfU/YxlNL7wAYhtngHQAVSTIl0boqUHVRqieVr5O4w0= diff --git a/src/etc/signify/makronix-root.pub b/src/etc/signify/makronix-root.pub new file mode 100644 index 0000000000..777009d90a --- /dev/null +++ b/src/etc/signify/makronix-root.pub @@ -0,0 +1,2 @@ +untrusted comment: Makronix release ROOT key (offline, signs release keys) public key +RWRp581tt5FeS7WDffTmII729vcgjyBzobXdfuHT8tW4bCd5RKdnMf+H diff --git a/tools/sign-release.sh b/tools/sign-release.sh index 47be9adc35..d63b173b25 100755 --- a/tools/sign-release.sh +++ b/tools/sign-release.sh @@ -1,14 +1,19 @@ #!/bin/sh # License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -# sign-release.sh -- the signify signature of a release. +# sign-release.sh -- the signify signature of a release, in a chain. # # usage: sign-release.sh sign FILE... # sign-release.sh verify FILE... +# sign-release.sh sign-key RELEASE-PUBKEY # -# sign: writes FILE.sig next to every FILE. The private key is named by -# SIGNIFY_SECKEY and is never in the tree (GOAL.md, 2026-11-16). -# verify: checks FILE.sig with the public key, /etc/signify/makronix-0.99.pub -# by default (SIGNIFY_PUBKEY overrides). +# The root key signs the release key once; the release key signs the files of +# a release. The root key is offline and never in the tree: sign-key takes +# its path from SIGNIFY_ROOT_SECKEY. The release key takes its path from +# SIGNIFY_SECKEY. +# +# verify checks the chain first: /etc/signify/makronix-root.pub against +# /etc/signify/makronix-0.99.pub.sig (SIGNIFY_ROOT_PUBKEY, SIGNIFY_PUBKEY +# override), then FILE.sig against the release key. # # What is signed: RELEASEDIR/source/sets/SHA512 (the SHA512 of the sets) and # the medium's package list (RELEASEDIR/.../binary/packages/pkg_summary.gz or @@ -29,7 +34,7 @@ die() SIGNIFY=$(command -v signify 2>/dev/null || command -v signify-openbsd 2>/dev/null) \ || die "no signify (security/signify)" -[ $# -ge 2 ] || die "usage: $0 sign|verify FILE..." +[ $# -ge 2 ] || die "usage: $0 sign|verify|sign-key ARG..." cmd=$1 shift @@ -44,9 +49,24 @@ sign) echo "sign-release: $f.sig" done ;; +sign-key) + [ $# -eq 1 ] || die "usage: $0 sign-key RELEASE-PUBKEY" + [ -n "${SIGNIFY_ROOT_SECKEY:-}" ] || die "SIGNIFY_ROOT_SECKEY is not set" + [ -r "$SIGNIFY_ROOT_SECKEY" ] || die "cannot read $SIGNIFY_ROOT_SECKEY" + [ -f "$1" ] || die "no $1" + "$SIGNIFY" -S -s "$SIGNIFY_ROOT_SECKEY" -m "$1" -x "$1.sig" \ + || die "signing $1 with the root key failed" + echo "sign-release: $1.sig (signed by the root key)" + ;; verify) PUB=${SIGNIFY_PUBKEY:-/etc/signify/makronix-0.99.pub} - [ -r "$PUB" ] || die "cannot read $PUB (signify public key)" + ROOT=${SIGNIFY_ROOT_PUBKEY:-/etc/signify/makronix-root.pub} + [ -r "$PUB" ] || die "cannot read $PUB (signify release key)" + if [ -r "$ROOT" ] && [ -r "$PUB.sig" ]; then + "$SIGNIFY" -V -p "$ROOT" -m "$PUB" -x "$PUB.sig" \ + || die "the release key $PUB is not signed by the root key" + echo "sign-release: $PUB: signed by the root key" + fi for f in "$@"; do [ -f "$f" ] || die "no $f" [ -f "$f.sig" ] || die "no $f.sig"