feat(apply): guard managed target activation

Co-authored-by: GPT-6 <gpt-6@openai.com>
This commit is contained in:
ZeusinaandGPT-6 Bot committed 2026-10-10 08:29:56 +03:00
1 parent 71e37ffaef
commit cdeb67f0dd
7 files changed
+914 -46

No files matched your search

+30 -6
View File
@@ -2,6 +2,27 @@
Go CLI for scanning and checking YouTube TLS bypass strategies with `blockcheckw`.
## Manual managed-test activation (not deployed)
`managed init|status|apply` requires exact role `managed-test`, target ID
`zapret-autotune-managed-v1`, a provisioned runtime marker and zapret executables,
and a private dedicated mount at `/var/lib/zapret-autotune/target`.
`ZAPRET_CONFIG` must equal `/var/lib/zapret-autotune/target/config`: the standalone
full config is allowed only in that fresh target volume, never over an existing
service config. Existing-service include fragments are not implemented.
The managed proxy must equal `socks5://127.0.0.1:$SOCKS_PORT` and that listener
must be owned by target-local `ss-local`; arbitrary loopback/host ports fail.
Init creates a private disabled baseline and identity/journal without overwriting
existing config. Status shows generation/hash/groups, not secrets or live health.
Apply accepts `--frontend-candidate ID --googlevideo-candidate ID` and requires
a qualified pair, fixed target init executable and explicit runtime-config
binding. It uses daemon-only reload and target-local Player API post-check, with
atomic rollback on failure. See [MANAGED_TARGET.md](MANAGED_TARGET.md) for guards
and provisioning prerequisites. No container/deploy files, autonomous loop,
remote activation, firewall setup or Xray changes are included. Image
compatibility and route/rollback gates are not yet remotely proven; adapter
tests/build are deferred to the orchestrator.
## One-shot Player API health
```sh
@@ -35,7 +56,7 @@ threshold and cooldown are validated future recovery policy settings only:
The future managed target is a **brand-new prod-like zapret2-ss container in the
test environment only**, not the existing container. Its stable configurable
SOCKS endpoint must be loopback-accessible to this probe and same-host Xray.
The one-shot command does not persist health. This increment does not create or change any container, apply
The one-shot command does not persist health. This command does not create or change any container, apply
configuration, restart services or roll back anything. Xray configuration is
out of scope and will be configured separately by the user. Run this command in
the host network context where that loopback endpoint is reachable; Docker
@@ -73,8 +94,9 @@ their existing target constraint. Database failures emit no options.
Signed URLs are not printed. Scanner diagnostics are retained in restricted
artifact files rather than relayed to the terminal. No configuration is applied,
no profile is marked active, and no service is restarted. The staged pipeline is
scan/propose now → eventual install → monitoring; install and monitoring are
**not implemented**. Manual proposal-only recovery is available below.
scan/propose → guarded manual managed-test activation → future monitoring;
container provisioning and monitoring are **not implemented**. Manual
proposal-only recovery is available below.
No-argument `tune youtube` remains frontend-only and unchanged.
## Alternatives-first recovery (proposal only)
@@ -129,7 +151,7 @@ and its TLS1.2/TLS1.3 3/3 pass results are committed together before options are
printed; failed scans/checks are recorded as failed runs without a candidate.
Database initialization or persistence errors return nonzero and emit no options.
`status` shows the latest recorded run, or explicitly says there is no recorded
run. Candidates are **PROPOSED, not active**; there is no apply command and
run. Candidates are **PROPOSED, not active**; this journal does not track managed activation and
production health is not checked. A later failed run is shown instead of an older
proposal. An output-write failure can leave a verified proposal recorded, but
still returns nonzero.
@@ -158,7 +180,8 @@ the token does not introduce automatic expiry or crash reconciliation.
State survives reopening the database; a crash during recovery leaves the lock
held, pending future explicit crash reconciliation. Existing history/candidates
are unchanged. These operations are not wired to `health youtube` or recovery:
**no daemon, autonomous probe, apply or container/Xray changes are added**.
**no daemon, autonomous probe or container/Xray changes are added**. Manual
managed activation is separate from this policy foundation.
Schema v3 adds immutable strategy candidate definitions (group, declared exact
endpoints, args and normalized-args fingerprint) and endpoint/protocol evidence.
@@ -167,7 +190,8 @@ Each newly successful tune saves its exact verified combined frontend profile fo
in the same transaction as the existing run. Qualification requires every declared
endpoint to pass exactly 3/3 for both TLS1.2 and TLS1.3, with full success/coverage.
Existing v2 history is unchanged and is not backfilled into independent candidates.
Candidates have no active/installed state; apply and monitor remain unimplemented.
Candidates have no DB active/installed state; managed activation uses its own
durable config journal. Autonomous monitoring remains unimplemented.
The explicit `tune googlevideo` path adds exact-cache proposals only.
Proposed runs store a SHA-256 fingerprint of validated arguments with separator
whitespace normalized and argument order preserved; repeated proposals retain