feat: add configurable PID1-owned DoH forwarding
Default managed SOCKS hostname DNS to verified HTTPS with literal-IP bootstrap and no plaintext fallback. Supervise the loopback forwarder with private anchored readiness and preserve foreign markers. Include configuration, deployment, documentation and offline checks. Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
1 parent
ea886e5bc8
commit
367d956ae3
20 files changed
+2383
-37
No files matched your search
+23
-3
@@ -320,7 +320,11 @@ signed URLs; use `docker compose ... config --quiet` for validation.
|
||||
| --- | --- |
|
||||
| `ZAPRET_AUTOTUNE_IMAGE` | Local build/test default `zapret-autotune-managed-target:local`; production promotion requires a managed-target `repository@sha256:<digest>` |
|
||||
| `SS_PASSWORD` | Required independent hex-only secret, at least 32 characters; deployment README generates 64 |
|
||||
| `SS_DNS_SERVER` | Empty (unchanged resolver); optional literal IPv4/IPv6 for target-only native ss-server DNS, validated before launch |
|
||||
| `ZAPRET_AUTOTUNE_DNS_MODE` | `doh` default; explicit `native` opts into the old resolver, never automatic fallback |
|
||||
| `ZAPRET_AUTOTUNE_DOH_URL` | `https://dns.google/dns-query`; HTTPS/443 path, no userinfo/query/fragment; path may be secret |
|
||||
| `ZAPRET_AUTOTUNE_DOH_BOOTSTRAP_IPS` | Compose default empty: parser selects `8.8.8.8,8.8.4.4` only for exact default Google URL; custom provider requires explicit 1–4 comma-separated literal IPs without spaces |
|
||||
| `ZAPRET_AUTOTUNE_DOH_TIMEOUT_SEC` | `5`; integer 1–30 |
|
||||
| `SS_DNS_SERVER` | Explicit native mode only: empty retains base resolver or literal IPv4/IPv6; ignored in DoH mode |
|
||||
| `ZAPRET_AUTOTUNE_YOUTUBE_SERVICE` | `0` (legacy) or opt-in `1`; explicitly forwarded by Compose |
|
||||
| `ZAPRET_AUTOTUNE_GOOGLEVIDEO_MODE` | `cold` default or `adaptive` (requires service `1`); explicitly forwarded |
|
||||
| `ZAPRET_AUTOTUNE_GOOGLEVIDEO_VIDEO_IDS` | JSON array of 1..5 unique VideoIDs; defaults to only the primary ID; explicitly forwarded |
|
||||
@@ -375,10 +379,26 @@ errors never authorize retry. No new dependency, host service installation or
|
||||
external process manager is required. SIGTERM/SIGINT cancels backoff or the running
|
||||
monitor, waits for bounded restoration and joins children before exit.
|
||||
|
||||
In default DoH mode PID 1 first starts the Go UDP/TCP loopback DNS forwarder,
|
||||
waits at most five seconds for its owned private PID marker, and only then starts
|
||||
ss-server with `-d 127.0.0.1:5353`. No host DNS port or DNS/iptables changes are
|
||||
made. Hostname SOCKS traffic and managed `socks5h` checks use the same encrypted
|
||||
HTTPS resolver; clients must enable remote SOCKS DNS, not resolve locally or
|
||||
send IP literals. Bootstrap uses configured literal IPs with verified TLS and
|
||||
marked direct sockets excluding probe/live NFQUEUE. Endpoint failures produce
|
||||
SERVFAIL without child exit or plaintext fallback. A forwarder crash, unlike an
|
||||
upstream outage, uses the same bounded technical retry budget. The DNS child
|
||||
stays alive through monitor restoration, zapret stop and SS joins; it is then
|
||||
terminated/joined within five seconds and only its validated readiness inode is
|
||||
removed using PID1-held directory/file anchors. Foreign/stale/replaced readiness
|
||||
is preserved and vetoes startup/retry; SIGKILL does not lose owned cleanup proof. Explicit
|
||||
native mode has no DNS child. See the deployment README for provider settings
|
||||
and scope limits. New DoH runtime acceptance remains pending.
|
||||
|
||||
Compose restart remains disabled: a blanket container restart could loop over a
|
||||
safety refusal or reset the in-container retry budget. Compose stop grace is 240s:
|
||||
the sequential cleanup budget is 140s (45s monitor join, 45s reconciliation plus
|
||||
5s kill grace, 30s zapret stop plus 5s kill grace, and two 5s SS joins), with room
|
||||
the sequential cleanup budget is 145s (45s monitor join, 45s reconciliation plus
|
||||
5s kill grace, 30s zapret stop plus 5s kill grace, two 5s SS joins and a 5s DNS join), with room
|
||||
for a deferred 45s startup command plus kill grace and scheduling overhead.
|
||||
The join watchdog runs in a fresh shell and is cancelled when its child finishes;
|
||||
graceful shutdown does not wait out the watchdog's full deadline.
|
||||
|
||||
Reference in new issue
Block a user