fix(monitor): check seeds without scanning workers
This commit is contained in:
1 parent
1b660a0435
commit
98309a356a
5 files changed
+41
-26
No files matched your search
@@ -8,6 +8,7 @@
|
||||
- **2026-10-10 remote retry:** scanning the correct `www.youtube.com` host still produced `working=0`. Diagnosis: scan left NFQUEUE workers 200–207 in the isolated target namespace; the subsequent `check --no-conflict-cleanup` preserved those workers and every candidate immediately failed. A manual `check` after a standalone scan confirmed the queue-conflict failure. Stopped only the new target (old target/Xray untouched), preserving its empty state. Managed recovery now opts into blockcheck conflict cleanup because it runs only after stopping zapret in the dedicated isolated namespace; ordinary CLI callers retain `--no-conflict-cleanup`. Local test/build pass; remote rerun pending.
|
||||
- **2026-10-10 retry after worker-cleanup fix:** deployed commit `a762763` and recreated only the isolated target, retaining generation-0 empty strategy state. Managed `www.youtube.com` scan completed; subsequent shortlist check returned an empty `strategies` array, and the persistent monitor correctly continued into a later recovery scan instead of exiting. At the last reachable check the target was up, generation 0, no candidates, and 3 probe failures; SSH profile `dev` then disconnected during the next scan. Acceptance remains incomplete; reconnect and inspect current process/status/report before any further action. Old target and Xray remained untouched.
|
||||
- **2026-10-10 diagnostic follow-up:** SSH reconnected. Existing SOCKS `127.0.0.1:1080` returned HTTP 200 for `https://www.youtube.com/`; direct host curl and fresh target SOCKS `127.0.0.1:11080` timed out, as expected with the disabled baseline. Independently ran `blockcheckw check` in a clean disposable container on the same target bridge using the existing frontend profile; it passed TLS 1.2 and TLS 1.3, 3/3 each. The default scan corpus omitted this exact profile, while `blockcheckw scan --from-file` found it on the same host in under a second. Repeated strict checks showed intermittent TLS 1.3 timeouts (one protocol 3/3 while the other fell to 1/2); the managed seed now retries the tiny exact-host corpus up to five times before falling back to the hour-long default search. Stopped only the dedicated target to end repeated full scans; its state remains generation 0 with no applied candidates. `go test ./...`, build, static deploy guard, entrypoint syntax, and diff checks pass. Deploy and remote acceptance rerun pending. Old container/Xray untouched.
|
||||
- **2026-10-10 seed retry follow-up:** Repeated checks in one disposable namespace confirmed intermittent TLS 1.3 timeouts persist across attempts. Managed seed was changed to run `blockcheckw check` directly (not a scan that leaves NFQUEUE workers), retrying only the small seed; identical TLS 1.2/TLS 1.3 args are now de-duplicated before combined revalidation. The previous five-attempt seed-scan build is stopped; dedicated target state still has no committed candidates. Local tests/build/static checks pass; deploy and runtime verification of the direct-check seed remain pending. Old target/Xray untouched.
|
||||
- Added `managed monitor` and supervision only in the dedicated target entrypoint: guarded target-owned DB/identity before singleton, policy 5m/3/30m with bounded CLI/env validation, owned-loopback Player API probe/discovery without direct fallback, fixed blockcheck/zapret argv with context cancellation/join. Startup bootstraps only without a qualified active frontend, tries saved scenarios first, then scans; unresolved GGC keeps monitoring; safety/DB errors stop it. SIGTERM waits for monitor restoration before stopping target-local zapret/SS. Local fake CLI/entrypoint tests are present.
|
||||
|
||||
- Hardened managed recovery artifacts: общий `revalidateCandidate` удаляет старый combined JSON перед каждым check, remove errors/missing/malformed report fail closed; scan shortlist проверяется на regular file и mtime не раньше whole-second scan start (production использует unique temp path). Добавлены fake-only regression tests stale/missing shortlist, stale combined, remove failure и infrastructure classification/restoration. Tests/build/network не запускались; verification deferred orchestrator, CLI/entrypoint не добавлены.
|
||||
|
||||
@@ -42,10 +42,10 @@ func runManagedBlockcheck(ctx context.Context, binary, domain string, stdout, st
|
||||
domain = strings.ToLower(domain)
|
||||
if args := managedSeedArgs(domain); args != "" {
|
||||
// A transient endpoint timeout can invalidate one protocol's strict 3/3
|
||||
// check even when the seeded scan found it; retry this tiny corpus before
|
||||
// check even when the seeded candidate works; retry this tiny check before
|
||||
// spending an hour on the full built-in corpus.
|
||||
for attempt := 0; attempt < 5; attempt++ {
|
||||
path, err := runBlockcheckWithConflictCleanupAndSeed(ctx, binary, domain, stdout, stderr, true, args)
|
||||
path, err := runManagedSeedCheck(ctx, binary, domain, args, stdout, stderr)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
@@ -67,10 +67,6 @@ func runManagedBlockcheck(ctx context.Context, binary, domain string, stdout, st
|
||||
}
|
||||
|
||||
func runBlockcheckWithConflictCleanup(ctx context.Context, binary, domain string, stdout, stderr io.Writer, allowConflictCleanup bool) (string, error) {
|
||||
return runBlockcheckWithConflictCleanupAndSeed(ctx, binary, domain, stdout, stderr, allowConflictCleanup, "")
|
||||
}
|
||||
|
||||
func runBlockcheckWithConflictCleanupAndSeed(ctx context.Context, binary, domain string, stdout, stderr io.Writer, allowConflictCleanup bool, seedArgs string) (string, error) {
|
||||
if !validDomain(domain) {
|
||||
return "", fmt.Errorf("invalid DNS hostname: %q", domain)
|
||||
}
|
||||
@@ -98,21 +94,7 @@ func runBlockcheckWithConflictCleanupAndSeed(ctx context.Context, binary, domain
|
||||
}
|
||||
}
|
||||
domain = strings.ToLower(domain)
|
||||
var seedPath string
|
||||
if seedArgs != "" {
|
||||
rows, err := combinedVanillaRowsForHost(seedArgs, domain)
|
||||
if err != nil {
|
||||
return path, err
|
||||
}
|
||||
seedPath = filepath.Join(workdir, "managed-seed.txt")
|
||||
if err := os.WriteFile(seedPath, []byte(rows), 0600); err != nil {
|
||||
return path, err
|
||||
}
|
||||
}
|
||||
scanArgs := []string{"--workers", "8", "scan", "--domain", domain, "--protocols", "tls12,tls13", "--auto"}
|
||||
if seedPath != "" {
|
||||
scanArgs = append(scanArgs, "--from-file", seedPath)
|
||||
}
|
||||
if !allowConflictCleanup {
|
||||
scanArgs = append(scanArgs, "--no-conflict-cleanup")
|
||||
}
|
||||
@@ -142,6 +124,30 @@ func runBlockcheckWithConflictCleanupAndSeed(ctx context.Context, binary, domain
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func runManagedSeedCheck(ctx context.Context, binary, host, args string, stdout, stderr io.Writer) (string, error) {
|
||||
rows, err := combinedVanillaRowsForHost(args, host)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
f, err := os.CreateTemp("", "blockcheckw-managed-seed-*.txt")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
path := f.Name()
|
||||
if err := f.Close(); err != nil {
|
||||
return path, err
|
||||
}
|
||||
input := path + ".input"
|
||||
if err := os.WriteFile(input, []byte(rows), 0600); err != nil {
|
||||
return path, err
|
||||
}
|
||||
checkArgs := []string{"--workers", "32", "check", "--from-file", input, "--domain", strings.ToLower(host), "--take", "1", "--passes", "3", "--auto", "--output", path + ".check.json"}
|
||||
if err := runBlockcheckCommand(ctx, binary, "", checkArgs, stdout, stderr); err != nil {
|
||||
return path, err
|
||||
}
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func blockcheckVanillaReport(dir string) (string, error) {
|
||||
entries, err := os.ReadDir(dir)
|
||||
if err != nil {
|
||||
|
||||
@@ -253,15 +253,12 @@ func TestRunManagedBlockcheckSeedsKnownProfileThroughBlockcheck(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
decoder := json.NewDecoder(bytes.NewReader(argv))
|
||||
var scanArgs, checkArgs []string
|
||||
if err := decoder.Decode(&scanArgs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var checkArgs []string
|
||||
if err := decoder.Decode(&checkArgs); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !slices.Contains(scanArgs, "--from-file") || slices.Contains(scanArgs, "--no-conflict-cleanup") || slices.Contains(checkArgs, "--no-conflict-cleanup") {
|
||||
t.Fatalf("managed seeded commands=%q then %q", scanArgs, checkArgs)
|
||||
if !slices.Contains(checkArgs, "--from-file") || !slices.Contains(checkArgs, "--passes") || slices.Contains(checkArgs, "--no-conflict-cleanup") {
|
||||
t.Fatalf("managed seeded check=%q", checkArgs)
|
||||
}
|
||||
if seed := managedSeedArgs("rr3.googlevideo.com"); !strings.Contains(seed, "fakeddisorder") {
|
||||
t.Fatalf("missing exact-host GGC seed: %q", seed)
|
||||
|
||||
@@ -213,6 +213,9 @@ func selectBlockcheckEvidence(r io.Reader, expected, group, host string, recover
|
||||
if !ok {
|
||||
return "", fmt.Errorf("no fully passing check strategy for both tls12 and tls13")
|
||||
}
|
||||
if protocol == "tls13" && c.Args == best["tls12"].Args {
|
||||
continue
|
||||
}
|
||||
for _, token := range strings.Fields(c.Args) {
|
||||
if strings.HasPrefix(token, "--payload=") {
|
||||
if payloads[token] {
|
||||
|
||||
@@ -396,6 +396,14 @@ func TestCombinedVanillaRowsAndSelection(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectBlockcheckDoesNotDuplicateIdenticalCrossProtocolArgs(t *testing.T) {
|
||||
args := "--payload=tls_client_hello --lua-desync=hostfakesplit:disorder_after:ip_autottl=-3,3-20:repeats=1 --lua-desync=multidisorder:pos=1,midsld"
|
||||
got, err := selectBlockcheckArgsForTarget(strings.NewReader(combinedReportFixture(args)), "", "frontend", "www.youtube.com")
|
||||
if err != nil || got != args {
|
||||
t.Fatalf("selected args=%q err=%v", got, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCombinedBlockcheckOutput(t *testing.T) {
|
||||
args := "--payload=tls_client_hello --lua-desync=hostfakesplit --lua-desync=multidisorder"
|
||||
valid := combinedReportFixture(args)
|
||||
|
||||
Reference in new issue
Block a user