Restore public IP reporting with a shell-free native helper
Build and Push Docker Image / build (push) Successful in 52s

This commit is contained in:
Ketan Patel committed 2026-10-04 19:15:40 -04:00
1 parent b43f776d54
commit 18c861f52c
4 files changed
+118 -7

No files matched your search

+32 -1
View File
@@ -31,7 +31,9 @@ The default Dockerfile exports the Alpine 3.24 rTorrent binary, musl libraries,
CA certificates and timezone/terminal data into a `scratch` image. It contains
no shell, package manager, BusyBox, or build tools. The native launcher removes
the stale session lock and execs rTorrent; it also supplies the TCP health check.
CI starts rTorrent and verifies an SCGI XML-RPC request before publication.
CI starts rTorrent, runs the native public-IP helper through a scheduled
`execute.capture` hook, and verifies the resulting address over SCGI before
publication.
Use the default Compose file with the existing `.env` and mounted data:
@@ -53,3 +55,32 @@ the default Compose file now use distroless `:latest`. Root UID, HOME=/root,
SCGI port 5001, download paths and the session volume remain supported.
Mounted `rtorrent.rc` execute hooks must use programs available in the image;
shell commands and arbitrary external utilities are unavailable.
## Public-IP reporting without a shell
The image includes `/usr/local/bin/rtorrent-public-ip`, a native libcurl helper.
It accepts `URL [PROXY]`, limits connections to 5 seconds and the complete lookup
to 10 seconds, validates an IPv4 response, and prints it without a trailing newline.
Failed requests and invalid responses return an error instead of an address.
It does not require bash or the curl command-line executable.
Replace the old `get_public_ip_address` definition and `ip_tick` schedule in the
host file mounted at `/root/.rtorrent.rc` with the following (adjust the proxy):
```ini
method.insert = get_public_ip_address, simple|private, "execute.capture=/usr/local/bin/rtorrent-public-ip,https://ipv4.icanhazip.com,http://10.10.12.60:8118"
schedule2 = ip_tick, 0, 1800, "network.local_address.set=(get_public_ip_address)"
```
Remove or leave commented the old bash-based definition; do not define both.
Pull and recreate the services from your Compose project after publication:
```sh
docker compose pull rtorrent
docker compose up -d --force-recreate rtorrent floodui
```
The image cannot replace a bind-mounted configuration. Updating the image alone
will not fix an existing `execute.capture=bash,...` hook. This migration preserves
public-IP reporting through the configured proxy while keeping the runtime shell-free.