Files
felhom.eu/documentation/audits/qbittorrent-2026-10-12/transmission-bench/03-init-script.txt
T
admin 5148fe1e11
gates / gates (push) Successful in 6m29s
audit: download clients for the catalog - qbittorrent + transmission measured twice, five defects fixed
The arr stack had no download client: radarr/sonarr/seerr decide what to fetch
and hand it to one, and there was none. Both templates are written and measured
on the bench (LXC 9401) and on 9202 through the product. Neither is published -
the onboarding records are not complete and the gate refuses a template without
one.

Found by measuring, each fixed:
- qBittorrent was unreachable on its own public name: WebUI\ServerDomains takes
  SEMICOLONS; a comma list answers 401 Invalid Host header to everything.
  Undocumented upstream; measured four ways through the app's own API.
- Both clients asked the household's router to open a port (qBittorrent
  UPnP/NAT-PMP ON, Transmission port-forwarding-enabled true). The box opens no
  port at home. qBittorrent ignores the seeded Session\UseUPnP=false at first
  start but honours the same setting through its API, so it goes through
  after_install: ON at 17:21:51, OFF at 17:21:56.
- Transmission could never go healthy (401 on every path, curl -f exit 22).
- Transmission's host whitelist refused its own healthcheck.
- The apparent lock-out was a measurement artefact: with stranger and household
  on two different addresses, the stranger is banned and the household signs in
  at the same instant (204). qBittorrent reads the real visitor address.

Downloads work with no inbound port, measured: 34 seeds / 4 MB/s (qBittorrent),
48 peers (Transmission), both complete, port confirmed closed.

9202 is back on the live catalog with both apps removed; bench 9401 stopped as
found; the live catalog's main untouched.
2026-10-12 19:38:23 +02:00

75 lines
3.1 KiB
Plaintext

# the init script the image runs (read inside the image)
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# copy config
if [[ ! -f /config/settings.json ]]; then
cp /defaults/settings.json /config/settings.json
fi
if [[ -n "${USER}" ]] && [[ -n "${PASS}" ]]; then
echo -E "$(jq -r '.["rpc-authentication-required"] = true' /config/settings.json)" >/config/settings.json
echo -E "$(jq -r --arg user "${USER}" '.["rpc-username"] = $user' /config/settings.json)" >/config/settings.json
echo -E "$(jq -r --arg pass "${PASS}" '.["rpc-password"] = $pass' /config/settings.json)" >/config/settings.json
else
echo -E "$(jq -r '.["rpc-authentication-required"] = false' /config/settings.json)" >/config/settings.json
fi
if [[ -n "${WHITELIST}" ]]; then
echo -E "$(jq -r '.["rpc-whitelist-enabled"] = true' /config/settings.json)" >/config/settings.json
echo -E "$(jq -r --arg whitelist "${WHITELIST}" '.["rpc-whitelist"] = $whitelist' /config/settings.json)" >/config/settings.json
else
echo -E "$(jq -r '.["rpc-whitelist-enabled"] = false' /config/settings.json)" >/config/settings.json
fi
if [[ -n "${HOST_WHITELIST}" ]]; then
echo -E "$(jq -r '.["rpc-host-whitelist-enabled"] = true' /config/settings.json)" >/config/settings.json
echo -E "$(jq -r --arg host_whitelist "${HOST_WHITELIST}" '.["rpc-host-whitelist"] = $host_whitelist' /config/settings.json)" >/config/settings.json
else
echo -E "$(jq -r '.["rpc-host-whitelist-enabled"] = false' /config/settings.json)" >/config/settings.json
fi
if [[ -n "${PEERPORT}" ]]; then
echo -E "$(jq -r --argjson peerport "${PEERPORT}" '.["peer-port"] = $peerport' /config/settings.json)" >/config/settings.json
echo -E "$(jq -r '.["peer-port-random-on-start"] = false' /config/settings.json)" >/config/settings.json
fi
if ! test -f /proc/net/if_inet6; then
echo -E "$(jq -r '.["rpc-bind-address"] = "0.0.0.0"' /config/settings.json)" > /config/settings.json
fi
if [[ -n "${UMASK}" ]]; then
echo -E "$(jq -r --arg umask "${UMASK}" '.["umask"] = $umask' /config/settings.json)" >/config/settings.json
fi
if [[ -z ${LSIO_NON_ROOT_USER} ]] && [[ -z ${LSIO_READ_ONLY_FS} ]]; then
# Handle old theme locations
mkdir -p {/transmissionic,/combustion-release,/flood-for-transmission,/kettu,/transmission-web-control}
echo /transmissionic /combustion-release /flood-for-transmission /kettu /transmission-web-control | xargs -n1 ln -s /defaults/index.html
fi
if [[ -z ${LSIO_NON_ROOT_USER} ]]; then
lsiown -R abc:abc \
/config
if grep -qe ' /downloads ' /proc/mounts; then
if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then
lsiown abc:abc /downloads
fi
if [[ "$(stat -c '%U' /downloads/complete)" != "abc" ]]; then
lsiown abc:abc /downloads/complete
fi
if [[ "$(stat -c '%U' /downloads/incomplete)" != "abc" ]]; then
lsiown abc:abc /downloads/incomplete
fi
fi
if grep -qe ' /watch ' /proc/mounts; then
if [[ "$(stat -c '%U' /watch)" != "abc" ]]; then
lsiown abc:abc /watch
fi
fi
fi