Homepage: give the user page its own login (dankuser)

The homepage user page + shared data now use a dedicated CADDY_HOMEPAGE_HASH
(username dankuser), separate from the shared family password (CADDY_BASICAUTH_HASH,
username dank, still used by the other vhosts) and the operator password
(CADDY_ADMIN_HASH, username frank, the /admin/ page). This lets the homepage be
re-logged independently without touching the other sites. deploy.sh renders the
new placeholder; the .env.example documents all three hashes.
This commit is contained in:
Frank
2026-08-23 21:08:21 -07:00
parent 677046768b
commit c58dab0a89
4 changed files with 18 additions and 9 deletions
+9 -2
View File
@@ -25,9 +25,16 @@ GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=changeme
# Caddy (the homelab's single reverse proxy, on this host)
# bcrypt hash of the homepage/protected-vhost password (caddy hash-password).
# deploy.sh renders it into /home/dank/Containers/caddy/Caddyfile.
# bcrypt hashes (caddy hash-password). deploy.sh renders them into
# /home/dank/Containers/caddy/Caddyfile.
# CADDY_BASICAUTH_HASH: the shared family password (the other vhosts: gitea,
# grafana, search, ...). Username: dank.
CADDY_BASICAUTH_HASH=changeme
# CADDY_ADMIN_HASH: the operator-only password (the homepage /admin/ page).
# Username: frank.
CADDY_ADMIN_HASH=changeme
# CADDY_HOMEPAGE_HASH: the homepage user-page password. Username: dankuser.
CADDY_HOMEPAGE_HASH=changeme
# Hermes -> Signal (signal-cli daemon on the host, port 8080)
# E.164 number of the linked Signal account (your primary number, for Note-to-Self).
+3 -3
View File
@@ -67,16 +67,16 @@ dankclaw.franksdank.cloud {
@data path /services.json /status.json /app.js /style.css /deployed.js
handle @data {
basicauth {
dank REPLACE_WITH_HASH
dankuser REPLACE_WITH_HOMEPAGE_HASH
frank REPLACE_WITH_ADMIN_HASH
}
file_server
}
# Everything else (the user page): the family (Q18).
# Everything else (the user page): the homepage login (dankuser).
handle {
basicauth {
dank REPLACE_WITH_HASH
dankuser REPLACE_WITH_HOMEPAGE_HASH
}
try_files /index.html
file_server
+3 -1
View File
@@ -166,11 +166,13 @@ if [ '${COPY_SHARED[$TARGET]}' = '1' ]; then
# '|| true' so a missing hash warns below instead of aborting under set -e.
CADDY_BASICAUTH_HASH=\"\$(grep -E '^CADDY_BASICAUTH_HASH=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)\"
CADDY_ADMIN_HASH=\"\$(grep -E '^CADDY_ADMIN_HASH=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)\"
if [ -n \"\${CADDY_BASICAUTH_HASH}\" ] && [ -n \"\${CADDY_ADMIN_HASH}\" ]; then
CADDY_HOMEPAGE_HASH=\"\$(grep -E '^CADDY_HOMEPAGE_HASH=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)\"
if [ -n \"\${CADDY_BASICAUTH_HASH}\" ] && [ -n \"\${CADDY_ADMIN_HASH}\" ] && [ -n \"\${CADDY_HOMEPAGE_HASH}\" ]; then
# '|' delimiter: the bcrypt hash contains '/' characters.
mkdir -p /home/dank/Containers/caddy
sed -e \"s|REPLACE_WITH_HASH|\${CADDY_BASICAUTH_HASH}|g\" \\
-e \"s|REPLACE_WITH_ADMIN_HASH|\${CADDY_ADMIN_HASH}|g\" \\
-e \"s|REPLACE_WITH_HOMEPAGE_HASH|\${CADDY_HOMEPAGE_HASH}|g\" \\
dankclaw/Caddyfile > /home/dank/Containers/caddy/Caddyfile
else
echo ' WARN: a Caddy hash is not set in .env; keeping the placeholder(s)'
+3 -3
View File
@@ -10,8 +10,8 @@ setup() {
CADDY="$REPO_ROOT/dankclaw/Caddyfile"
}
@test "the homepage has a root hash and a distinct admin hash (Q18/Q38)" {
grep -q "REPLACE_WITH_HASH" "$CADDY"
@test "the homepage has its own hash and a distinct admin hash" {
grep -q "REPLACE_WITH_HOMEPAGE_HASH" "$CADDY"
grep -q "REPLACE_WITH_ADMIN_HASH" "$CADDY"
}
@@ -43,5 +43,5 @@ setup() {
# page's credential for these, so the block must accept both users.
grep -qE "@data[[:space:]]+path[[:space:]]+/services\.json[[:space:]]+/status\.json" "$CADDY"
grep -qE "handle[[:space:]]+@data" "$CADDY"
grep -qE "dank[[:space:]]+REPLACE_WITH_HASH" "$CADDY"
grep -qE "dankuser[[:space:]]+REPLACE_WITH_HOMEPAGE_HASH" "$CADDY"
}