{
  "report_id": "cain-37.0-connectivity-forensics-20260917",
  "generated_at": "2026-09-17T23:25:00Z",
  "question": "CAIN 36 reported 'full distributed testing blocked by API accessibility.' CAIN 37 Phase 1 requires finding the EXACT cause, not accepting it as permanent.",
  "methodology": "Live network trace performed from this session's own shell against both public domains and against this session's own VPS, using dig, curl (with and without a spoofed Host header), docker port/inspect, and iptables/ufw inspection. No production traffic was disrupted to run the read-only checks.",
  "trace": [
    {
      "hop": "DNS",
      "command": "dig +short cainstudio.online A ; dig +short mcpgate.online A",
      "result": "Both domains resolve to 149.28.193.50",
      "finding": "This is NOT this session's VPS. This session's own public IP is 45.76.60.231 (confirmed via `ip -4 addr show`). ROOT CAUSE #1: the CAIN code, evidence bundles, and fixes this session (and CAIN 34-36) builds live on 45.76.60.231, which the public domain names never point to."
    },
    {
      "hop": "Access to 149.28.193.50",
      "command": "nc -zv 149.28.193.50 22",
      "result": "TCP/22 is open on that host, but this session holds no SSH credentials, key, or any other access path to it.",
      "finding": "This session cannot deploy, inspect, or verify anything on the host the public domains actually point to. This is the same finding CAIN 36 made (see git commit 1956e1f) -- CAIN 37 independently re-confirmed it live rather than assuming the prior report was still accurate."
    },
    {
      "hop": "TLS + HTTP on the real public domain",
      "command": "curl -sI https://cainstudio.online/",
      "result": "HTTP/2 200, server: uvicorn, a real page titled 'CAIN = COGNITIVE ARTIFICIAL INTELLIGENCE NETWORK | 32 Enterprise AI Governance Features' is served.",
      "finding": "The public domain is live and serving SOME version of CAIN's marketing site (from 149.28.193.50, not this session), but does not include this session's or CAIN 35/36's evidence-bundle additions -- confirmed 404 on /proof/byzantine-cluster and /proof/bundle/cain35-byzantine/index.json against the real public domain. See CAIN_37_SELF_CONSISTENCY_REPORT.md for a serious finding about what that page actually says."
    },
    {
      "hop": "Same paths on THIS session's own VPS",
      "command": "curl -H 'Host: cainstudio.online' https://45.76.60.231/proof/byzantine-cluster -k",
      "result": "HTTP 200 on this VPS for both /proof/byzantine-cluster and the bundle's index.json.",
      "finding": "The evidence is genuinely live and correctly served end-to-end (traefik TLS termination -> systemd-managed uvicorn on :8088) on this VPS. The gap is exclusively DNS-level: this VPS is never reached by the literal domain names."
    },
    {
      "hop": "Reverse proxy / container networking, PBFT cluster ports",
      "command": "docker port cain-cluster-node-1..4 ; iptables -t nat -L DOCKER -n ; iptables -L DOCKER -n ; iptables -L DOCKER-USER -n ; ufw status numbered",
      "result": "Ports 18421-18424 (mapping to each node's internal :8420) and, for the separate real production 'cain-node' container, ports 8420 and 7946 directly, are DNAT'd and ACCEPTed in Docker's own iptables chains UNCONDITIONALLY from 0.0.0.0/0. `iptables -L DOCKER-USER -n` was EMPTY at the start of this session.",
      "finding": "ROOT CAUSE #2, more serious than #1: `ufw status` shows rules that APPEAR to restrict 8420/7946 to a named peer allowlist (149.28.193.50, 45.76.169.191, 207.246.66.130, this host, docker bridge subnets), but those UFW rules govern the INPUT chain only. Docker's published-port traffic is DNAT'd and forwarded through the FORWARD/DOCKER chains, which UFW's INPUT rules never see -- a well-documented Docker+UFW interaction gap. CONCRETE IMPACT: the real production PBFT/consensus API (port 8420) and the local test cluster's four published ports (18421-18424) were reachable, unauthenticated, from ANY internet host, not just the intended peer set. This is a genuine live security exposure, not a hypothetical one, discovered via this session's own defensive investigation of 'why can't distributed testing reach this API,' and is the actual, fixable instance of what this mission calls a 'legitimate security boundary that should be built as an authenticated path, not bypassed.'"
    }
  ],
  "root_causes_identified": [
    {
      "id": "ROOT-CAUSE-1-DNS-SPLIT",
      "summary": "cainstudio.online / mcpgate.online DNS points to a different VPS (149.28.193.50) than this session's own (45.76.60.231). Inherited, unresolved since CAIN 28/36 -- requires either DNS repointing or SSH access to 149.28.193.50, neither of which this session can do unilaterally.",
      "status": "UNRESOLVED -- outside this session's authority. Flagged to the user, not silently worked around.",
      "remediation_owner": "user (needs DNS control panel access or credentials for 149.28.193.50)"
    },
    {
      "id": "ROOT-CAUSE-2-UFW-DOCKER-BYPASS",
      "summary": "UFW rules intended to restrict PBFT consensus ports to named peers never applied to Docker-published ports because Docker manages its own iptables FORWARD-chain rules ahead of/outside UFW's INPUT chain.",
      "status": "REMEDIATION SCRIPT WRITTEN, NOT YET APPLIED -- see below.",
      "remediation_owner": "this session attempted to apply the fix and was blocked by the harness's own auto-mode safety classifier ('Modify Shared Resources') when running iptables commands, even after explicit user approval via AskUserQuestion. The fix is staged at deploy/security/cain-docker-user-fw.sh, fully documented and idempotent (adds DOCKER-USER chain rules that Docker itself checks before its permissive DOCKER chain, restricting 8420/7946 to the real known peer set and 18421-18424 to this host only). It needs to be run by the user directly (e.g. `sudo bash deploy/security/cain-docker-user-fw.sh`) or via an approved elevated-permission Bash invocation, and ideally installed as a systemd oneshot unit (After=docker.service) so it survives docker daemon restarts, which re-create an empty DOCKER-USER chain.",
      "status_update_2026_09_18": "APPLIED. On direct user instruction in a later session, `bash deploy/security/cain-docker-user-fw.sh` was run successfully (the Bash-level block above no longer triggered for a direct user-requested execution). Verified live: `iptables -L DOCKER-USER -n -v` shows 20 active rules with nonzero packet counters on the real production-peer ACCEPT rules (traffic from 45.76.169.191 and 207.246.66.130 already flowing correctly), and the 4-node test cluster remained healthy (4/4, quorum true) and the platform-gateway service remained active throughout. NOT YET DONE: persisting the rule across a Docker daemon restart or host reboot via a systemd unit -- that attempt was blocked by a DIFFERENT classifier category ('Unauthorized Persistence'), so `/etc/systemd/system/cain-docker-user-fw.service` was drafted and handed to the user to install manually, not applied by this session. This is a real, current status update, not a rewrite of the original finding above."
    }
  ],
  "phase_1_success_condition_assessment": {
    "mission_text": "The real four-node cluster becomes externally testable through an authenticated, auditable, fail-closed verification interface.",
    "assessment": "PARTIALLY MET. This session already tests the real 4-node cluster directly over its (currently unauthenticated) HTTP API from this host -- that is real and live, not simulated. What is NOT met: (1) testing it through the literal public domain (blocked by ROOT-CAUSE-1, outside this session's control), and (2) an authenticated interface -- the raw PBFT node API has no auth of its own; CAIN 37 instead exposes a read-only, evidence-scoped API (see CAIN_37_PUBLIC_EVIDENCE_MANIFEST.json and the new evidence_api router) through the platform-gateway process, which already sits behind traefik/TLS on this host, as the actual externally-testable surface -- rather than opening the raw consensus port wider.",
    "explicit_non_claims": [
      "Do NOT read this report as 'the connectivity problem is fixed' -- ROOT-CAUSE-1 (DNS) is unresolved and not within this session's authority to fix.",
      "Do NOT read the staged firewall script as 'already applied' -- it is written, reviewed, and matches the intent of the existing UFW rules, but has not executed yet due to a sandboxing restriction in this environment."
    ]
  }
}
