Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
apt/dnf repositories: offline primary + 2-year signing subkey (~/Work/.sf/repo-key.sh), the committed website/sculptforge.asc pins the key pages.yml accepts, release.sh check stops 120 days before the subkey expires, repos.yml tests the real key shape and a tampered .rpm (#149)
islandmedd5eb1c6acafb
diff --git a/.github/workflows/repos.yml b/.github/workflows/repos.ymlindex 269f159d..90ffbac9 100644--- a/.github/workflows/repos.yml+++ b/.github/workflows/repos.yml@@ -3,7 +3,8 @@ name: Package repositories# tools/publish/package_repos.sh (release workflow) and package_repos_fetch.sh (pages.yml) end to end, with the# latest release's packages and a throwaway test key made in this job (never the real REPO_SIGNING_KEY): build the# signed metadata, put the site together, serve it locally, then install SculptForge with apt in Debian and Ubuntu-# and with dnf in Fedora and Rocky 9 containers, and check that a package whose bytes differ is refused.+# and with dnf in Fedora and Rocky 9 containers, and check that a package whose bytes differ is refused+# (apt and dnf) and that metadata signed by a key other than the committed website/sculptforge.asc is refused.on:push:@@ -35,10 +36,16 @@ jobs:ls -l- name: Metadata, signed with a throwaway keyrun: |+ # Shaped like the real key (~/Work/.sf/repo-key.sh): a certify-only primary that CI never holds (a stub in+ # the secret), a signing subkey, no passphrase.export GNUPGHOME=$(mktemp -d)- gpg --batch --pinentry-mode loopback --passphrase test --quick-gen-key "Test only <test@invalid>" rsa4096 sign 1d- REPO_SIGNING_KEY=$(gpg --batch --pinentry-mode loopback --passphrase test --armor --export-secret-keys) \- REPO_SIGNING_PASSPHRASE=test tools/publish/package_repos.sh dist dist/sculptforge-package-repos.tar.gz+ g() { gpg --batch --quiet --pinentry-mode loopback --passphrase '' "$@"; }+ g --quick-gen-key "Test only <test@invalid>" rsa4096 cert 1d+ fpr=$(gpg --batch --with-colons --list-keys | awk -F: '$1 == "fpr" {print $10; exit}')+ g --quick-add-key "$fpr" rsa4096 sign 1d+ gpg --batch --armor --export "$fpr" > "$RUNNER_TEMP/test-key.asc"+ REPO_SIGNING_KEY=$(g --armor --export-secret-subkeys "$fpr") \+ tools/publish/package_repos.sh dist dist/sculptforge-package-repos.tar.gz(cd dist && sha256sum sculptforge-package-repos.tar.gz >> SHA256SUMS.txt)# The sums signed as release.yml signs them (tools/release/sign_sums.sh), with a throwaway Ed25519 key.openssl genpkey -algorithm ed25519 -out "$RUNNER_TEMP/release.pem"@@ -51,7 +58,14 @@ jobs:# Sums not signed by the release key: refused before anything is downloadedif PACKAGE_REPOS_PUBKEY_HEX=$(printf '%064d' 0 | tr 0 a) PACKAGE_REPOS_LOCAL=dist \tools/publish/package_repos_fetch.sh vTEST site; then echo "unsigned sums accepted"; exit 1; fi+ # A committed website/sculptforge.asc of another key: refused+ mkdir other && GNUPGHOME=$(mktemp -d) sh -c 'gpg --batch -q --pinentry-mode loopback --passphrase "" \+ --quick-gen-key "Other <other@invalid>" ed25519 sign 1d && gpg --batch --armor --export > other/sculptforge.asc'+ if PACKAGE_REPOS_LOCAL=dist tools/publish/package_repos_fetch.sh vTEST other; then echo "another key accepted"; exit 1; fi+ # The committed key, as on the site+ cp "$RUNNER_TEMP/test-key.asc" site/sculptforge.ascPACKAGE_REPOS_LOCAL=dist tools/publish/package_repos_fetch.sh vTEST site+ cmp site/sculptforge.asc site/apt/sculptforge.asc && cmp site/sculptforge.asc site/rpm/sculptforge.ascfind site -type f | sort(cd site && python3 -m http.server 8000 --bind 127.0.0.1 >/dev/null 2>&1 &)sleep 1@@ -60,9 +74,8 @@ jobs:for img in debian:stable ubuntu:24.04; dodocker run --rm --network host "$img" sh -euc 'apt-get update -q >/dev/null && apt-get install -y -q curl ca-certificates >/dev/null- install -d -m 0755 /etc/apt/keyrings- curl -fsSL http://127.0.0.1:8000/apt/sculptforge.asc -o /etc/apt/keyrings/sculptforge.asc- echo "deb [signed-by=/etc/apt/keyrings/sculptforge.asc] http://127.0.0.1:8000/apt stable main" > /etc/apt/sources.list.d/sculptforge.list+ curl -fsSL http://127.0.0.1:8000/sculptforge.asc -o /usr/share/keyrings/sculptforge.asc+ echo "deb [signed-by=/usr/share/keyrings/sculptforge.asc] http://127.0.0.1:8000/apt stable main" > /etc/apt/sources.list.d/sculptforge.listapt-get update -qapt-get install -y -q sculptforge >/dev/nulldpkg -s sculptforge | grep -E "^(Version|Architecture)"@@ -83,9 +96,13 @@ jobs:printf 'x' >> "$deb"docker run --rm --network host debian:stable sh -euc 'apt-get update -q >/dev/null && apt-get install -y -q curl ca-certificates >/dev/null- install -d -m 0755 /etc/apt/keyrings- curl -fsSL http://127.0.0.1:8000/apt/sculptforge.asc -o /etc/apt/keyrings/sculptforge.asc- echo "deb [signed-by=/etc/apt/keyrings/sculptforge.asc] http://127.0.0.1:8000/apt stable main" > /etc/apt/sources.list.d/sculptforge.list+ curl -fsSL http://127.0.0.1:8000/sculptforge.asc -o /usr/share/keyrings/sculptforge.asc+ echo "deb [signed-by=/usr/share/keyrings/sculptforge.asc] http://127.0.0.1:8000/apt stable main" > /etc/apt/sources.list.d/sculptforge.listapt-get update -qif apt-get install -y -q sculptforge; then echo "apt installed a tampered package"; exit 1; fiecho "apt refused the tampered package"'+ rpm=$(ls site/rpm/packages/*.x86_64.rpm)+ printf 'x' >> "$rpm"+ docker run --rm --network host -v "$PWD/test.repo:/etc/yum.repos.d/sculptforge.repo:ro" fedora:latest sh -euc '+ if dnf install -y -q sculptforge; then echo "dnf installed a tampered package"; exit 1; fi+ echo "dnf refused the tampered package"'diff --git a/docs/design/package-repos.md b/docs/design/package-repos.mdindex 5f69114b..2a8f5565 100644--- a/docs/design/package-repos.md+++ b/docs/design/package-repos.md@@ -1,15 +1,14 @@# apt and dnf repositories (#149)-Status: built and tested, **off until the maintainer creates the signing key** (below). Until then nothing changes+Status: built and tested, **off until the maintainer creates the signing key** (`~/Work/.sf/repo-key.sh`, below). Until then nothing changesfor users: releases carry no repository metadata and the site has no /apt or /rpm.## What users get```sh# Debian, Ubuntu, Mint, Pop!_OS (amd64, arm64)-sudo install -d -m 0755 /etc/apt/keyrings-curl -fsSL https://sculptforge.app/apt/sculptforge.asc | sudo tee /etc/apt/keyrings/sculptforge.asc >/dev/null-echo "deb [signed-by=/etc/apt/keyrings/sculptforge.asc] https://sculptforge.app/apt stable main" |+sudo curl -fsSL -o /usr/share/keyrings/sculptforge.asc https://sculptforge.app/sculptforge.asc+echo "deb [signed-by=/usr/share/keyrings/sculptforge.asc] https://sculptforge.app/apt stable main" |sudo tee /etc/apt/sources.list.d/sculptforge.listsudo apt update && sudo apt install sculptforge@@ -18,6 +17,9 @@ sudo curl -fsSL -o /etc/yum.repos.d/sculptforge.repo https://sculptforge.app/rpmsudo dnf install sculptforge # asks once to trust the key: compare its fingerprint with the guide's```+The apt key goes in `/usr/share/keyrings/` (not `/etc/apt/keyrings/`) so a later `.deb` can ship that same file+and renew it on every upgrade (see "Expiry" below).+Then `apt upgrade` / `dnf upgrade` bring each release. The packages are the release's own `.deb` and `.rpm`files, byte for byte (the ones the release workflow verified and smoke-tested).@@ -43,44 +45,42 @@ The key lives only in the `release` environment (tags `v*` only), reaches one stoutside that step's temporary keyring (the passphrase goes to gpg through a 0600 file, never a command line). The tools are installed in an earlier step that never sees it. pages.ymland everything else never see it.-## The signing key (maintainer: once, about 5 minutes)+## The signing key (maintainer: once, about 2 minutes)Not the app's update key (`UPDATE_SIGNING_KEY`): a separate OpenPGP key used only for these repositories.-- **Type**: OpenPGP, RSA 4096, sign-only primary key, no subkeys (works with every apt, including `sqv` on Debian- 13+, and with dnf/rpm on RHEL 9).+- **Shape**: an **offline primary** key (RSA 4096, certify only, no expiry) and a **signing subkey** (RSA 4096,+ 2 years). RSA works with every apt, including `sqv` on Debian 13+, and with dnf/rpm on RHEL 9.- **Identity**: `SculptForge packages <[email protected]>` (no personal name or address).-- **Expiry**: none. apt and dnf keep the copy users installed and never refresh it, so an expiring key silently- stops every user's updates on the expiry date. Rotation (below) handles compromise instead.-- **Where it is made**: on the laptop, in a temporary keyring in RAM (`/dev/shm`), never in `~/.gnupg`.-- **Where the private part lives**: GitHub Actions secrets `REPO_SIGNING_KEY` (armored private key) and- `REPO_SIGNING_PASSPHRASE`, in the **`release` environment only**: not repository secrets, not `member-release`.- One offline copy in the password manager: the armored private key, the passphrase and the revocation- certificate gpg writes (`openpgp-revocs.d/<fingerprint>.rev`).--```sh-export GNUPGHOME=$(mktemp -d -p /dev/shm)-gpg --quick-gen-key "SculptForge packages <[email protected]>" rsa4096 sign never-# (pick a long passphrase when asked; it goes in the password manager and the second secret)-gpg --armor --export-secret-keys | gh secret set REPO_SIGNING_KEY --env release -R islandmed/SculptForge-gh secret set REPO_SIGNING_PASSPHRASE --env release -R islandmed/SculptForge # paste the passphrase-gpg --armor --export-secret-keys; cat "$GNUPGHOME"/openpgp-revocs.d/*.rev # both into the password manager-gpg --fingerprint # send the fingerprint to the coordinator-rm -rf "$GNUPGHOME"; unset GNUPGHOME-```--From the next release on, the repositories go live by themselves.--**The coordinator then**: checks that https://sculptforge.app/apt/dists/stable/InRelease is signed by that-fingerprint (`gpg --show-keys` on `/apt/sculptforge.asc`), adds the snippets above and the fingerprint to-docs/guide/installing.md ("Package managers": apt and dnf **Available**), install/README.md and the home page note,-and replies on #149 (credit @NicTanghe).+- **Made by** `~/Work/.sf/repo-key.sh`, run by the maintainer in their own terminal (it asks for a passphrase), in a+ temporary keyring in RAM (`/dev/shm`), never `~/.gnupg`. It keeps in `~/Work/.sf/secrets/repo-key/` (chmod 700):+ the full secret key **encrypted with that passphrase** (which lives only in the password manager, so nothing on+ the laptop, agents included, can use the primary), gpg's revocation certificate, the public key and its+ fingerprint. It sets one secret, `REPO_SIGNING_KEY`, in the **`release` environment only**: the signing subkey+ with the primary as a stub, unprotected (the environment secret is its protection; no passphrase secret).+ `--print` prints it to paste instead of setting it with gh.+- **The public key** is committed as `website/sculptforge.asc` (sculptforge.app/sculptforge.asc); pages.yml refuses+ repository metadata signed by any other primary key and copies the committed key to `/apt` and `/rpm`.++**The coordinator then**: commits `~/Work/.sf/secrets/repo-key/sculptforge.asc` as `website/sculptforge.asc` (site+lane); from the next release on the repositories go live by themselves. Check that+https://sculptforge.app/apt/dists/stable/InRelease verifies against it, add the snippets above and the fingerprint+to docs/guide/installing.md ("Package managers": apt and dnf **Available**), install/README.md and the home page+note, and close #149 (credit @NicTanghe).++## Expiry++`scripts/release.sh` (step check) stops a release once the subkey has less than 120 days left. Then the maintainer+runs `~/Work/.sf/repo-key.sh --extend` (2 more years, same keys, the secret replaced) and the coordinator commits+the new `website/sculptforge.asc`. Users' installed copies keep the old date, so **before the first extension+(by 2028-07)** the `.deb` must ship `/usr/share/keyrings/sculptforge.asc` and the `.rpm` the key for dnf, so every+upgrade renews them (app lane, its own branch; the key file exists only once the key is made).## Rotation and compromise-- **Suspected leak** (a secret exposed, a stolen laptop with the password-manager copy unlocked): make a new key- exactly as above, replace both secrets, release at once, and announce in the release notes, #announcements and- #149 that apt users re-run the `curl ... sculptforge.asc` line (dnf asks to import the new key by itself on the+- **Suspected leak** (a secret exposed, a stolen laptop with the password-manager copy unlocked): move `~/Work/.sf/secrets/repo-key` aside, make a new key+ exactly as above (it replaces the secret), release at once, and announce in the release notes, #announcements and+ #149 that apt users re-run the `curl ... sculptforge.asc` line (until the packages ship the key) (dnf asks to import the new key by itself on thenext upgrade). Publish the old key's revocation certificate on docs/guide/security.md.- **Planned rotation** (optional, e.g. every 5 years or a stronger algorithm): the same steps without the revocation;announce a release ahead.diff --git a/scripts/release.sh b/scripts/release.shindex 274108a2..675fcb09 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -337,6 +337,16 @@ preflight() {grep -q '^set(SCULPTFORGE_PRERELEASE "[a-z0-9.]*")$' CMakeLists.txt ||die "CMakeLists.txt lost its set(SCULPTFORGE_PRERELEASE \"\") line that step bump sets" "restore it under project() (git log -p CMakeLists.txt), commit"python3 -c 'import json, sys; json.load(open(sys.argv[1]))' website/latest.json 2>/dev/null || die "website/latest.json is not valid JSON" "fix it, commit"+ # The apt/dnf signing subkey expires after 2 years (docs/design/package-repos.md): stop 120 days ahead, while+ # there is time for the renewed key to reach users before the old date.+ if [ -f website/sculptforge.asc ]; then+ local kexp+ command -v gpg >/dev/null || die "gpg is not installed (it checks website/sculptforge.asc's expiry)" "install gnupg"+ kexp=$(gpg --batch --with-colons --show-keys website/sculptforge.asc 2>/dev/null |+ awk -F: '$1 == "sub" && $2 !~ /[rei]/ && $12 ~ /s/ {print ($7 == "" ? 9999999999 : $7)}' | sort -n | tail -1)+ [ -n "$kexp" ] && [ "$kexp" -gt $(($(date +%s) + 120 * 86400)) ] ||+ die "the apt/dnf signing subkey in website/sculptforge.asc expires ${kexp:+on $(date -d "@$kexp" +%F)}${kexp:-(none valid)}" "Tony: ~/Work/.sf/repo-key.sh --extend (in his terminal); then copy ~/Work/.sf/secrets/repo-key/sculptforge.asc to website/sculptforge.asc, commit, push main"+ fi# The members' publishing path: release.yml's actions pinned to commit SHAs, INSIDERS_REPO_TOKEN only in the# member-release environment (docs/releasing.md, "Secrets").out=$(python3 tools/release/check_workflows.py 2>&1) || die "the release workflows aren't locked down: $out" "fix .github/workflows (docs/releasing.md, \"Secrets\"), commit, push main"diff --git a/tools/publish/package_repos.sh b/tools/publish/package_repos.shindex 1e428202..99653032 100755--- a/tools/publish/package_repos.sh+++ b/tools/publish/package_repos.sh@@ -8,7 +8,7 @@# FILES.txt: "<path on the site> <release asset name>" for every package the metadata names# website/apt and website/rpm are put together from it by tools/publish/package_repos_fetch.sh (pages.yml), which# downloads those assets. The signature covers each package's SHA-256, so apt and dnf refuse any other bytes.-# Signing key: REPO_SIGNING_KEY (armored OpenPGP private key) and REPO_SIGNING_PASSPHRASE in the environment, as+# Signing key: REPO_SIGNING_KEY (armored OpenPGP signing subkey; REPO_SIGNING_PASSPHRASE if it has one) in the environment, as# the release workflow's `release` environment provides them. Needs apt-ftparchive (apt-utils), createrepo_c, gpg.set -euo pipefaildist=$(cd "$1" && pwd)diff --git a/tools/publish/package_repos_fetch.sh b/tools/publish/package_repos_fetch.shindex 123106b9..5fd1e6ae 100755--- a/tools/publish/package_repos_fetch.sh+++ b/tools/publish/package_repos_fetch.sh@@ -43,8 +43,20 @@ get sculptforge-package-repos.tar.gz "$work/repos.tar.gz"check sculptforge-package-repos.tar.gz "$work/repos.tar.gz"mkdir "$work/x"tar -C "$work/x" -xzf "$work/repos.tar.gz" --no-same-owner+# sculptforge.app/sculptforge.asc is committed (website/sculptforge.asc, made by ~/Work/.sf/repo-key.sh): the release's+# metadata must be signed by that same primary key; before it is committed, the release's copy goes there.+fprs() { gpg --batch --with-colons --show-keys "$1" 2>/dev/null | awk -F: '$1 == "pub" {p=1; next} $1 == "fpr" && p {print $10; p=0}'; }+if [ -f "$site/sculptforge.asc" ]; then+ [ -n "$(fprs "$site/sculptforge.asc")" ] && [ "$(fprs "$site/sculptforge.asc")" = "$(fprs "$work/x/apt/sculptforge.asc")" ] ||+ { echo "package_repos_fetch: $tag's repositories are signed by $(fprs "$work/x/apt/sculptforge.asc"), not website/sculptforge.asc's $(fprs "$site/sculptforge.asc")" >&2; exit 1; }+else+ cp "$work/x/apt/sculptforge.asc" "$site/sculptforge.asc"+firm -rf "$site/apt" "$site/rpm"cp -r "$work/x/apt" "$work/x/rpm" "$site/"+# The committed key (it carries the latest subkey expiry) everywhere apt and dnf fetch it.+cp "$site/sculptforge.asc" "$site/apt/sculptforge.asc"+cp "$site/sculptforge.asc" "$site/rpm/sculptforge.asc"while read -r path asset; docase "$path" in apt/*|rpm/*) ;; *) echo "package_repos_fetch: unexpected path $path" >&2; exit 1 ;; esaccase "$path$asset" in *..*) echo "package_repos_fetch: unexpected path $path" >&2; exit 1 ;; esac