Derive the swarm ID with PBKDF2 instead of SHA-1
Anyone who sees the swarm IDs could test a GPU's worth of codes against all of them at once, about 8 % of the codes within a share's 6 minutes. 600,000 iterations of PBKDF2-SHA-256 cost a share ~50 ms and make that negligible. Old and new clients no longer find each other. Also note the open decisions for the server at pagequit.net. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b6b6e7c29b
commit
707248f36b
3 files changed
+76
-5
No files matched your search
@@ -1,7 +1,67 @@
|
||||
# TODO
|
||||
|
||||
## Server at pagequit.net, to decide
|
||||
|
||||
### Review of the coturn setup (STUN only, host network)
|
||||
|
||||
- Good as it is: `stun-only`, `no-tcp`, `no-tls`, `no-software-attribute`, CPU, memory and process
|
||||
limits with swap off, and log rotation. Host networking is right for STUN, so Docker's NAT can't
|
||||
change the source address the clients get back. Listening on IPv4 only matches DNS:
|
||||
`stun.pagequit.net` has an A record and no AAAA.
|
||||
- `coturn/coturn:latest` is the only unpinned version. Pin `coturn/coturn:4.18.0` (2026-09-08).
|
||||
- Add `no-cli`. On the host network, coturn's admin CLI would otherwise listen on the host's
|
||||
127.0.0.1:5766 if it's enabled.
|
||||
- Add `no-stun-backward-compatibility`. Browsers only use the current STUN protocol, so the old
|
||||
RFC 3489 requests and their extra MAPPED-ADDRESS can go, which also makes responses smaller for
|
||||
reflection attacks.
|
||||
- Check that the logs hold no client addresses: send a STUN request, then
|
||||
`docker compose logs coturn | grep <your IP>`. Logging each request is off by default and
|
||||
`log-binding` turns it on, so it should stay empty. Otherwise up to 20 MB of addresses stay around.
|
||||
- Missing compared to the tracker draft: `cap_drop: [ALL]` and
|
||||
`security_opt: [no-new-privileges:true]`. `read_only: true` is worth trying too, but coturn may
|
||||
need a writable `/var/run` or `/var/lib/coturn` (`tmpfs`).
|
||||
- coturn doesn't rate limit STUN requests. A response is about as big as the request, so it's a weak
|
||||
amplifier. If it gets abused, an nftables `limit` on the UDP port would help.
|
||||
|
||||
### Compared to the plan so far
|
||||
|
||||
- Caddy and coturn don't share a Docker network, coturn runs on the host network. The tracker joins
|
||||
Caddy's network (its name is in Caddy's compose file), coturn stays as it is.
|
||||
- Copy coturn's limits to the tracker, with smaller values: `cpus`, `mem_limit` equal to
|
||||
`memswap_limit`, `pids_limit`, and the same `json-file` log rotation.
|
||||
- Pin every version, coturn and the tracker alike.
|
||||
|
||||
### Decisions
|
||||
|
||||
1. **Which tracker.** Stock `bittorrent-tracker@11.2.3` behind Caddy works: tested locally with a
|
||||
real transfer from Chromium to Firefox, and it logs nothing with `--quiet`. A review found it too
|
||||
open to run unchanged:
|
||||
- it forwards any data and accepts messages up to 100 MiB
|
||||
- `scrape` lists all swarms even with `--no-stats`
|
||||
- it has no rate, byte or connection limits
|
||||
- it accepts any Origin
|
||||
|
||||
The recommendation is an own tracker for the WebTorrent subset HellCon uses, so the client stays
|
||||
unchanged and the public trackers keep working as fallbacks. Node 26 and `ws`, one file of about
|
||||
250 lines, enforcing:
|
||||
- an Origin allowlist and messages of at most 16 KiB
|
||||
- only `announce`, one offer per announce, and answers only to offers it delivered, once
|
||||
- per connection: a message rate, about 64 KiB of forwarded data, and at most 7 minutes
|
||||
- connections per IP (from `X-Forwarded-For`), total connections and peers per swarm capped
|
||||
- empty swarms removed, nothing logged
|
||||
|
||||
Then decide where it lives: `tracker/` in this repo (new files, every fork gets it) or a separate
|
||||
repository.
|
||||
2. **After deploying:** put `wss://tracker.pagequit.net` first in `DEFAULT_TRACKERS` and keep the
|
||||
public trackers as fallbacks.
|
||||
|
||||
## Ideas
|
||||
|
||||
- Let the code confirm the connection instead of the user: both sides derive a second key from the
|
||||
code and send an HMAC over both DTLS fingerprints. An interposer without the code can't forge it,
|
||||
so the manual comparison and a careless confirm would no longer matter. Changes the protocol and
|
||||
the check UI, WebCrypto is enough.
|
||||
|
||||
- Resume interrupted transfers: the receiver already reports how much the download manager has
|
||||
read (`{ read }`), which is where a new connection could continue. The browser can't append to a
|
||||
finished or failed download though, so a resume would have to start a new one.
|
||||
|
||||
Reference in new issue
Block a user