wrolpi/scripts/add_caddy_apt_repo.sh
lrnselfreliance ecdad6c3e0
Caddy's apt repository is trusted through the key committed with WROLPi (#911)
The install scripts, the nginx-to-Caddy upgrade, and the Pi image downloaded Caddy's apt
signing key and source list over TLS and trusted them as-is, so a forged certificate could
serve a key that signs other caddy packages.  add_caddy_apt_repo.sh installs the key the
ISO already uses (fingerprint 65760C51EDEA2017CEA2CA15155B6D79CA56EA34) as an armored
keyring and names it in the source's signed-by.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:22:19 -06:00

12 lines
810 B
Bash
Executable file

#!/usr/bin/env bash
# Adds Caddy's apt repository, trusting the key committed with WROLPi instead of one downloaded over TLS (a forged
# certificate could serve a key that signs other caddy packages). The ISO uses the same key through live-build:
# debian-live-config/config/archives/caddy-stable.key, fingerprint 65760C51EDEA2017CEA2CA15155B6D79CA56EA34.
set -e
PROJECT_DIR=$(dirname "$(dirname "$(realpath "$0")")")
# apt reads an ASCII-armored key only from a .asc file.
install -m 644 "${PROJECT_DIR}/debian-live-config/config/archives/caddy-stable.key" /usr/share/keyrings/caddy-stable-archive-keyring.asc
echo 'deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.asc] https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main' \
>/etc/apt/sources.list.d/caddy-stable.list