feat: add declarative HTTPS resource checks

Add strict check-only resource configuration, owned DNS resolution and pinned HTTPS probes with bounded private output. Document the schema limits and pending remote acceptance; leave generic controller and strategy migration out of scope.

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-13 18:38:46 +03:00
1 parent 0623fa3323
commit 4d7c4b33c3
9 files changed
+1840 -6

No files matched your search

+51
View File
@@ -11,6 +11,57 @@ Clients must enable SOCKS5 remote DNS (e.g. browser remote DNS on the chosen
loopback SOCKS port). See [DNS configuration and limits](deploy/managed-target/README.md).
This new integration is not covered by the earlier clean-run acceptance.
## Configured HTTPS checks (checks only)
Inside the owned managed target, with its configured DNS/SOCKS environment, run:
```sh
zapret-autotune check --config /path/to/resource-check.example.json
```
See [the public example](resource-check.example.json). This does **not** select
strategies, migrate candidates/transactions, implement metrics, or declare READY;
`check youtube` and the YouTube qualification contract remain unchanged.
Version 1 supports `kind: "http"`, GET/HEAD, exact HTTPS DNS-hostname origins
(port 443 only), `tls12`, `tls13`, or `both`. All fields shown in the example are
required except `content_type` and `min_bytes` (default zero); IDs/group are lowercase bounded identifiers.
There are at most 16 services and 64 resources, 100–30000 ms per TLS probe,
and 1–5242880 maximum decoded bytes. HEAD requires `min_bytes: 0`; its advertised
Content-Length is not downloaded or used as a body limit. No redirects are accepted.
Expected statuses are explicit, non-redirect 200–599 codes; MIME is an optional
exact media type (parameters are ignored in the response).
This slice checks HTTP status, MIME and byte bounds only: no image/media decode,
Range probes, suffix scopes or per-resource DNS settings.
Replace `url` with `url_env` for a private URL; optional `headers_env` maps header
names to environment variable names (e.g. `{"Authorization":"CHECK_TOKEN"}`).
Secrets travel only over private child stdin, never argv/results/database.
Transport/framing headers (including Range and Accept-Encoding) cannot be
overridden. Range probes need a future explicit probe field, not a secret header.
Config files must be regular, non-symlink files no larger than 1 MiB; permissions
are left untouched. Unknown fields, duplicates, missing/invalid settings and
environment references reject the entire configuration before any probes.
Checks issue explicit framed A/AAAA DNS queries to the configured local DoH
forwarder: no `/etc/hosts`, search domains or system DNS fallback. CNAME chains
are bounded and validated; unrelated Additional glue is never a destination.
The root-owned forwarder must match PID 1's private readiness anchors, executable,
PID/network namespaces and both UDP/TCP listeners; the owned Shadowsocks chain
must actually route its resolver to that same listener before any probes.
Explicit native mode requires an IP-valued `SS_DNS_SERVER` and is **plaintext DNS,
not encrypted DoH**. Every answer must pass
the destination policy, then the chosen IP is pinned for SOCKS CONNECT while the
original hostname remains the TLS/SNI/certificate authority. Addresses are resolved
fresh per probe, not stored. Private targets require `allow_private: true` **and**
explicit `allowed_networks` CIDRs. CIDRs always restrict; metadata, link-local,
CGNAT, loopback, benchmark and other reserved ranges remain denied even with that opt-in.
Output is one JSON line per resource/TLS probe: IDs, bounded outcome, TLS,
decoded bytes, milliseconds and HTTP status only. Exit 0 means all checks passed;
1 means a resource failed/cancellation/output failure; 2 means invalid config or
unavailable ownership. Resource failures continue to other resources; ownership
failure stops all probes. These checks have unit/loopback-fixture coverage only,
not new remote acceptance or generic automated recovery/controller support.
## Production preparation (isolated clean-run acceptance passed)
The standalone deployment candidate is a **new isolated target**, never an