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.
This commit is contained in:
Michael Sloan committed 2026-11-23 22:13:12 -05:00
1 parent 6d105355f4
commit b910932394
2 files changed
+6 -4

No files matched your search

+4 -2
View File
@@ -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"
+2 -2
View File
@@ -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"