Skip to content

Commit

Permalink
fix: encryption salt keys for the plugin server (#25454)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Oct 9, 2024
1 parent 975659d commit c99d825
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/deploy-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export SENTRY_DSN="${SENTRY_DSN:-'https://[email protected]/1'}"
POSTHOG_SECRET=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
export POSTHOG_SECRET

ENCRYPTION_SALT_KEYS=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
export ENCRYPTION_SALT_KEYS

# Talk to the user
echo "Welcome to the single instance PostHog installer 🦔"
echo ""
Expand Down Expand Up @@ -128,6 +131,7 @@ EOF
# Write .env file
envsubst > .env <<EOF
POSTHOG_SECRET=$POSTHOG_SECRET
ENCRYPTION_SALT_KEYS=$ENCRYPTION_SALT_KEYS
SENTRY_DSN=$SENTRY_DSN
DOMAIN=$DOMAIN
EOF
Expand Down
9 changes: 9 additions & 0 deletions bin/upgrade-hobby
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ else
fi

[[ -f ".env" ]] && export $(cat .env | xargs) || ( echo "No .env file found. Please create it with POSTHOG_SECRET and DOMAIN set." && exit 1)
# we introduced ENCRYPTION_SALT_KEYS and so if there isn't one, need to add it
# check for it in the .env file
if ! grep -q "ENCRYPTION_SALT_KEYS" .env
then
ENCRYPTION_SALT_KEYS=$(head -c 28 /dev/urandom | sha224sum -b | head -c 56)
echo "ENCRYPTION_SALT_KEYS=$ENCRYPTION_SALT_KEYS" >> .env
fi


export POSTHOG_APP_TAG="${POSTHOG_APP_TAG:-latest-release}"

cd posthog
Expand Down

0 comments on commit c99d825

Please sign in to comment.