diff --git a/lndg/docker-compose.yml b/lndg/docker-compose.yml index 4b1d50384..fdb9a6675 100644 --- a/lndg/docker-compose.yml +++ b/lndg/docker-compose.yml @@ -14,10 +14,12 @@ services: volumes: - ${APP_LIGHTNING_NODE_DATA_DIR}:/root/.lnd:ro - ${APP_DATA_DIR}/data/db:/app/data + environment: + LNDG_CSRF_TRUSTED_ORIGINS: ${APP_LNDG_CSRF_TRUSTED_ORIGINS} command: - sh - -c - - python initialize.py -net '${APP_BITCOIN_NETWORK}' -rpc '${APP_LIGHTNING_NODE_IP}:${APP_LIGHTNING_NODE_GRPC_PORT}' -pw '${APP_PASSWORD}' -wn && python controller.py runserver 0.0.0.0:${APP_LNDG_PORT} + - python initialize.py -net '${APP_BITCOIN_NETWORK}' -rpc '${APP_LIGHTNING_NODE_IP}:${APP_LIGHTNING_NODE_GRPC_PORT}' -pw '${APP_PASSWORD}' -csrf "$${LNDG_CSRF_TRUSTED_ORIGINS}" -wn && python controller.py runserver 0.0.0.0:${APP_LNDG_PORT} networks: default: ipv4_address: ${APP_LNDG_IP} diff --git a/lndg/exports.sh b/lndg/exports.sh index 63ad16702..daed069ba 100644 --- a/lndg/exports.sh +++ b/lndg/exports.sh @@ -1,2 +1,25 @@ export APP_LNDG_IP="10.21.21.75" -export APP_LNDG_PORT="8889" \ No newline at end of file +export APP_LNDG_PORT="8889" + +# Trust only HTTPS origins belonging to this device, not forwarded request headers. +# initialize.py inserts -csrf into a Python list literal, so validate every host +# and separate origins with quotes as well as commas (not just commas). +export APP_LNDG_CSRF_TRUSTED_ORIGINS="$( + local_ips=$(hostname --all-ip-addresses 2>/dev/null) || local_ips="" + # Avahi may advertise umbrel-2.local after a name collision while the kernel + # hostname (and DEVICE_DOMAIN_NAME) remains umbrel. Match Umbrel's HTTPS names. + avahi_hostname=$(busctl --timeout=2 call org.freedesktop.Avahi / org.freedesktop.Avahi.Server GetHostNameFqdn 2>/dev/null | + sed -n 's/^s "\([a-zA-Z0-9.-]*\)"$/\1/p') || avahi_hostname="" + avahi_hostname="${avahi_hostname%.}" + separator="" + for host in "${DEVICE_DOMAIN_NAME}" "${DEVICE_HOSTNAME}" "$avahi_hostname" $local_ips; do + case "$host" in + ""|*[!a-zA-Z0-9.:-]*) continue ;; + esac + case "$host" in + *:*) host="[$host]" ;; + esac + printf '%shttps://%s:%s' "$separator" "$host" "$APP_LNDG_PORT" + separator="','" + done +)" diff --git a/lndg/umbrel-app.yml b/lndg/umbrel-app.yml index e3751548a..3be8efccb 100644 --- a/lndg/umbrel-app.yml +++ b/lndg/umbrel-app.yml @@ -2,7 +2,7 @@ manifestVersion: 1 id: lndg category: bitcoin name: LNDg -version: "1.11.1" +version: "1.11.1-patch.1" tagline: Analyze and automate your Lightning node management description: LNDg is your command center for running a profitable and efficient routing node. From quickly viewing your node's health, automated rebalancing, @@ -22,11 +22,6 @@ path: "" defaultUsername: lndg-admin deterministicPassword: true releaseNotes: >- - - Fixed payment and invoice synchronization when an index is zero - - - Improved security when displaying Lightning node aliases - - - Full release notes can be found at https://github.com/cryptosharks131/lndg/releases/tag/v1.11.1 + Fixed login and form submissions over HTTPS when accessing LNDg through your Umbrel's hostname or IP addresses, including Tailscale IP addresses. submitter: cryptosharks131 submission: https://github.com/getumbrel/umbrel/pull/1189