server: refuse unsigned releases and polluted reserved addresses
Self-update now verifies SHA256SUMS.sig (ed25519, relsign package) against a public key baked into the binary; the private key exists only in the CI secret store, so a compromised release host can withhold updates but not inject one. CI signs on every server-v* tag and hard-fails without the secret. Operators with their own pipeline override the key via ECHOLOT_SELF_UPDATE_PUBKEY (mint a pair with release-sign -gen). Startup also now proves 80/443 are actually free on the reserved measurement addresses by asking the OS (throwaway bind), not the config - CheckReserved could never see a stray process, and the adb-beacon receiver on 0.0.0.0:443 was exactly that. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
20cfecf566
commit
a49bef5821
@@ -10,12 +10,18 @@
|
||||
# releases don't trigger each other's pipelines.
|
||||
#
|
||||
# Required secrets:
|
||||
# REGISTRY_TOKEN personal access token with read+write package scope —
|
||||
# the built-in Actions token is NOT accepted by the
|
||||
# container registry (docker login → unauthorized).
|
||||
# Create: user Settings → Applications → Generate token.
|
||||
# REGISTRY_USER optional; defaults to the pushing actor's username.
|
||||
# The release job needs only the built-in GITHUB_TOKEN.
|
||||
# REGISTRY_TOKEN personal access token with read+write package scope —
|
||||
# the built-in Actions token is NOT accepted by the
|
||||
# container registry (docker login → unauthorized).
|
||||
# Create: user Settings → Applications → Generate token.
|
||||
# REGISTRY_USER optional; defaults to the pushing actor's username.
|
||||
# RELEASE_SIGNING_KEY base64 ed25519 seed that signs SHA256SUMS. Self-updating
|
||||
# servers verify the signature against the public key baked
|
||||
# into the binary (selfupdate.DefaultPublicKeyB64) and REFUSE
|
||||
# unsigned releases, so this job hard-fails without it —
|
||||
# a release nobody can install is better failed loudly here.
|
||||
# Mint a pair with: go run ./cmd/release-sign -gen
|
||||
# The release job otherwise needs only the built-in GITHUB_TOKEN.
|
||||
|
||||
name: server-release
|
||||
on:
|
||||
@@ -44,6 +50,18 @@ jobs:
|
||||
done
|
||||
(cd ../dist && sha256sum * > SHA256SUMS)
|
||||
|
||||
- name: Sign SHA256SUMS
|
||||
working-directory: server
|
||||
env:
|
||||
RELEASE_SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
run: |
|
||||
[ -n "$RELEASE_SIGNING_KEY" ] || { echo "::error::secret RELEASE_SIGNING_KEY is missing — self-updating servers refuse unsigned releases, so publishing one would strand the fleet. Add it under Settings → Actions → Secrets."; exit 1; }
|
||||
go run ./cmd/release-sign ../dist/SHA256SUMS
|
||||
# Verify with the key baked into the binary we just built — catches a
|
||||
# secret that does not match DefaultPublicKeyB64 before it ships.
|
||||
PUB=$(grep -o 'DefaultPublicKeyB64 = "[^"]*"' internal/selfupdate/selfupdate.go | cut -d'"' -f2)
|
||||
go run ./cmd/release-sign -verify -pub "$PUB" ../dist/SHA256SUMS
|
||||
|
||||
- name: Create release + attach binaries
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user