Files
felhom.eu/documentation/audits/qbittorrent-2026-10-12/bench/03-process-and-entrypoint.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

114 lines
3.1 KiB
Plaintext

# the running process (production binary, dropped to qbtUser)
PID USER COMMAND
1 root /sbin/tini -g -- /entrypoint.sh
7 qbtUser qbittorrent-nox --confirm-legal-notice --profile=/config --torrenting-port=6881 --webui-port=8080
93 root ps -o pid,user,args
# the image entrypoint, read inside the image
#!/bin/sh
downloadsPath="/downloads"
profilePath="/config"
qbtConfigFile="$profilePath/qBittorrent/config/qBittorrent.conf"
isRoot="0"
if [ "$(id -u)" = "0" ]; then
isRoot="1"
fi
if [ "$isRoot" = "1" ]; then
if [ -n "$PUID" ] && [ "$PUID" != "$(id -u qbtUser)" ]; then
sed -i "s|^qbtUser:x:[0-9]*:|qbtUser:x:$PUID:|g" /etc/passwd
fi
if [ -n "$PGID" ] && [ "$PGID" != "$(id -g qbtUser)" ]; then
sed -i "s|^\(qbtUser:x:[0-9]*\):[0-9]*:|\1:$PGID:|g" /etc/passwd
sed -i "s|^qbtUser:x:[0-9]*:|qbtUser:x:$PGID:|g" /etc/group
fi
if [ -n "$PAGID" ]; then
_origIFS="$IFS"
IFS=','
for AGID in $PAGID; do
AGID=$(echo "$AGID" | tr -d '[:space:]"')
addgroup -g "$AGID" "qbtGroup-$AGID"
addgroup qbtUser "qbtGroup-$AGID"
done
IFS="$_origIFS"
fi
fi
if [ ! -f "$qbtConfigFile" ]; then
mkdir -p "$(dirname $qbtConfigFile)"
cat << EOF > "$qbtConfigFile"
[BitTorrent]
Session\DefaultSavePath=$downloadsPath
Session\Port=6881
Session\TempPath=$downloadsPath/temp
Session\TempPathEnabled=true
[Meta]
MigrationVersion=9999
[Preferences]
WebUI\Port=8080
EOF
fi
argLegalNotice=""
_legalNotice=$(echo "$QBT_LEGAL_NOTICE" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
if [ "$_legalNotice" = "confirm" ]; then
argLegalNotice="--confirm-legal-notice"
else
# for backward compatibility
# TODO: remove in next major version release
_eula=$(echo "$QBT_EULA" | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]')
if [ "$_eula" = "accept" ]; then
echo "QBT_EULA=accept is deprecated and will be removed soon. The replacement is QBT_LEGAL_NOTICE=confirm"
argLegalNotice="--confirm-legal-notice"
fi
fi
argTorrentingPort=""
if [ -n "$QBT_TORRENTING_PORT" ]; then
argTorrentingPort="--torrenting-port=$QBT_TORRENTING_PORT"
fi
argWebUIPort=""
if [ -n "$QBT_WEBUI_PORT" ]; then
argWebUIPort="--webui-port=$QBT_WEBUI_PORT"
fi
if [ "$isRoot" = "1" ]; then
# those are owned by root by default
# don't change existing files owner in `$downloadsPath`
if [ -d "$downloadsPath" ]; then
chown qbtUser:qbtUser "$downloadsPath"
fi
if [ -d "$profilePath" ]; then
chown qbtUser:qbtUser -R "$profilePath"
fi
fi
# set umask just before starting qbt
if [ -n "$UMASK" ]; then
umask "$UMASK"
fi
if [ "$isRoot" = "1" ]; then
exec \
doas -u qbtUser \
qbittorrent-nox \
"$argLegalNotice" \
--profile="$profilePath" \
"$argTorrentingPort" \
"$argWebUIPort" \
"$@"
else
exec \
qbittorrent-nox \
"$argLegalNotice" \
--profile="$profilePath" \
"$argTorrentingPort" \
"$argWebUIPort" \
"$@"
fi