mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
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>
This commit is contained in:
parent
bde1209c63
commit
ecdad6c3e0
6 changed files with 71 additions and 8 deletions
12
scripts/add_caddy_apt_repo.sh
Executable file
12
scripts/add_caddy_apt_repo.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/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
|
||||
|
|
@ -63,8 +63,7 @@ grep wrolpi: /etc/passwd || useradd -md /home/wrolpi wrolpi -s "$(command -v bas
|
|||
|
||||
# Install Caddy from official apt repo if not already installed.
|
||||
if ! command -v caddy &>/dev/null; then
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --batch --yes --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
/opt/wrolpi/scripts/add_caddy_apt_repo.sh
|
||||
apt-get update
|
||||
apt-get install -y caddy
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ grep wrolpi: /etc/passwd || useradd -md /home/wrolpi wrolpi -s "$(command -v bas
|
|||
|
||||
# Install Caddy from official apt repo if not already installed.
|
||||
if ! command -v caddy &>/dev/null; then
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --batch --yes --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
/opt/wrolpi/scripts/add_caddy_apt_repo.sh
|
||||
apt-get update
|
||||
apt-get install -y caddy
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -292,8 +292,7 @@ if ! command -v caddy &>/dev/null; then
|
|||
systemctl stop nginx 2>/dev/null || :
|
||||
systemctl disable nginx 2>/dev/null || :
|
||||
# Install Caddy from official apt repo.
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --batch --yes --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
|
||||
/opt/wrolpi/scripts/add_caddy_apt_repo.sh
|
||||
apt-get update
|
||||
# Non-interactive: a conffile prompt (e.g. repair.sh already wrote /etc/caddy/Caddyfile)
|
||||
# would otherwise hang or abort under the tty-less wrolpi-upgrade.service.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue