From b91093239402d65f5938a012f2617ed2f52362cd Mon Sep 17 00:00:00 2001 From: Michael Sloan <89812914+Michael-A-Sloan@users.noreply.github.com> Date: Mon, 23 Nov 2026 22:13:12 -0500 Subject: [PATCH] Fix VAPID key generation on Unraid tail. Unraid treats a separated byte count as a filename, so the counts are attached to the tail and head flags. --- scripts/init-compose-env.sh | 6 ++++-- scripts/prepare-unraid.sh | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/init-compose-env.sh b/scripts/init-compose-env.sh index 84e9ef4..49f8371 100644 --- a/scripts/init-compose-env.sh +++ b/scripts/init-compose-env.sh @@ -74,8 +74,10 @@ hex32() { openssl rand -hex 32; } echo "FLUXER_MEDIA_PROXY_UPLOAD_RELAY_SECRET_BASE64=$(openssl rand -base64 32 | tr -d '\n')" echo "FLUXER_ACTIVITYPUB_SIGNING_KEY_BASE64=$(openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -outform DER 2>/dev/null | base64 | tr -d '\n')" openssl ecparam -name prime256v1 -genkey -noout -out "${tmp}.vapid" 2>/dev/null - pub="$(openssl ec -in "${tmp}.vapid" -pubout -outform DER 2>/dev/null | tail -c 65 | base64 | tr '/+' '_-' | tr -d '=\n')" - priv="$(openssl ec -in "${tmp}.vapid" -outform DER 2>/dev/null | tail -c +8 | head -c 32 | base64 | tr '/+' '_-' | tr -d '=\n')" + # Counts are attached (-c65, not -c 65). Unraid's tail treats a separated + # number as a filename. + pub="$(openssl ec -in "${tmp}.vapid" -pubout -outform DER 2>/dev/null | tail -c65 | base64 | tr '/+' '_-' | tr -d '=\n')" + priv="$(openssl ec -in "${tmp}.vapid" -outform DER 2>/dev/null | tail -c+8 | head -c32 | base64 | tr '/+' '_-' | tr -d '=\n')" echo "FLUXER_VAPID_PUBLIC_KEY=$pub" echo "FLUXER_VAPID_PRIVATE_KEY=$priv" echo "FLUXER_POSTGRES_MEMORY_LIMIT=1gb" diff --git a/scripts/prepare-unraid.sh b/scripts/prepare-unraid.sh index bf83959..a926f4d 100644 --- a/scripts/prepare-unraid.sh +++ b/scripts/prepare-unraid.sh @@ -229,8 +229,8 @@ if [[ ! -f "$STACK/.env" ]]; then if [[ -z "$(env_value FLUXER_VAPID_PUBLIC_KEY "$STACK/.env")" || -z "$(env_value FLUXER_VAPID_PRIVATE_KEY "$STACK/.env")" ]]; then vapid="$STACK/vapid.pem" openssl ecparam -name prime256v1 -genkey -noout -out "$vapid" 2>/dev/null - pub="$(openssl ec -in "$vapid" -pubout -outform DER 2>/dev/null | tail -c 65 | base64 | tr '/+' '_-' | tr -d '=\n')" - priv="$(openssl ec -in "$vapid" -outform DER 2>/dev/null | tail -c +8 | head -c 32 | base64 | tr '/+' '_-' | tr -d '=\n')" + pub="$(openssl ec -in "$vapid" -pubout -outform DER 2>/dev/null | tail -c65 | base64 | tr '/+' '_-' | tr -d '=\n')" + priv="$(openssl ec -in "$vapid" -outform DER 2>/dev/null | tail -c+8 | head -c32 | base64 | tr '/+' '_-' | tr -d '=\n')" rm -f "$vapid" set_env "FLUXER_VAPID_PUBLIC_KEY" "$pub" "$STACK/.env" set_env "FLUXER_VAPID_PRIVATE_KEY" "$priv" "$STACK/.env"