Plausible Community Edition up to ``3.2.0`` serves ``/storybook``, which compiles and runs code sent by any visitor (CVE-2026-8467, GHSA-mhcv-h7gf-57cf). It was used to install cryptocurrency miners in the container of a ``3.0.1`` deployment. ``3.2.1`` removes the endpoint. - Use ``docker.0k.io/plausible:3.2.1`` (from ``ghcr.io/plausible/community-edition:v3.2.1``). The database migrations run at start as before; ``3.0.1`` data migrates without manual step. - The default web-proxy rules refuse ``/storybook``, in case an older image is ever deployed again. - The Erlang release cookie of the image is created when the image is built, so it is the same on every installation. The ``init`` hook now generates one per installation (``release-cookie``) and sets ``RELEASE_DISTRIBUTION`` to ``none``: this single node opens no ``epmd`` nor distribution port. Assisted-by: Claude:claude-opus-5-5
45 lines
1.4 KiB
Bash
Executable File
45 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
SECRET_KEY_BASE="$SERVICE_DATASTORE"/secret-key
|
|
## Erlang release cookie. The image ships one in ``/app/releases/COOKIE``
|
|
## that is generated when the image is built, so it is the same for every
|
|
## installation of that image: replace it by one of our own.
|
|
RELEASE_COOKIE_FILE="$SERVICE_DATASTORE"/release-cookie
|
|
|
|
SHARE_DIR="$SERVICE_DATASTORE"/var/lib/plausible
|
|
mkdir -p $SHARE_DIR
|
|
|
|
uid=$(docker_get_uid "$SERVICE_NAME" "plausible")
|
|
|
|
if ! [ -f "$SECRET_KEY_BASE" ]; then
|
|
info "Generating secret key"
|
|
mkdir -p "${SECRET_KEY_BASE%/*}"
|
|
umask 077
|
|
openssl rand -base64 64 > "$SECRET_KEY_BASE"
|
|
else
|
|
info "Using existing secret key"
|
|
fi
|
|
|
|
if ! [ -f "$RELEASE_COOKIE_FILE" ]; then
|
|
info "Generating Erlang release cookie"
|
|
mkdir -p "${RELEASE_COOKIE_FILE%/*}"
|
|
(umask 077; openssl rand -hex 32 > "$RELEASE_COOKIE_FILE")
|
|
fi
|
|
|
|
secret_key_base=$(cat "$SECRET_KEY_BASE")
|
|
release_cookie=$(cat "$RELEASE_COOKIE_FILE")
|
|
|
|
## ``RELEASE_DISTRIBUTION: none``: Plausible Community Edition runs a
|
|
## single node and never needs Erlang distribution (the ``db createdb`` and
|
|
## ``db migrate`` commands use ``eval``), so the node opens no ``epmd`` nor
|
|
## distribution port that anything else could connect to.
|
|
init-config-add "
|
|
$SERVICE_NAME:
|
|
environment:
|
|
SECRET_KEY_BASE: \"$secret_key_base\"
|
|
RELEASE_COOKIE: \"$release_cookie\"
|
|
RELEASE_DISTRIBUTION: \"none\"
|
|
"
|
|
|
|
chown -v "$uid" "$SHARE_DIR"
|