Skip to content

Restrict agent-phase DNS egress to cluster DNS - #471

Open
knyazev741 wants to merge 1 commit into
ridgesai:mainfrom
knyazev741:fix/agent-dns-egress-cluster-only
Open

Restrict agent-phase DNS egress to cluster DNS#471
knyazev741 wants to merge 1 commit into
ridgesai:mainfrom
knyazev741:fix/agent-dns-egress-cluster-only

Conversation

@knyazev741

Copy link
Copy Markdown

What

  • scope the ridges-agent-egress DNS rule to cluster DNS (kube-system namespace selector) instead of leaving UDP/TCP 53 open to 0.0.0.0/0
  • update the policy header comment accordingly

Why

During the agent phase, port 443 egress is transparently intercepted (iptables REDIRECT) and gated by the proxy's SNI allowlist — but port 53 was open to the entire internet. Agent code could query arbitrary authoritative DNS servers, which is a working DNS-tunneling channel out of the sandbox: low bandwidth, but sufficient to exfiltrate data or relay traffic to non-whitelisted endpoints, bypassing the SNI allowlist entirely.

Scoping DNS egress to kube-system (kube-dns / CoreDNS, and node-local-dns DaemonSets where present) closes this gap while leaving legitimate resolution untouched — agent pods resolve through the cluster resolver anyway. The HTTPS interception path is unchanged.

Validation

  • manifest parses (7 YAML documents), git diff --check clean
  • not yet applied against a live kind cluster — worth a quick k8s/local smoke run to confirm CoreDNS resolution still works for agent pods

Related

While you're in the sandbox/networking corner — I'd appreciate a look at #469 (adds deepseek-ai/DeepSeek-V4-Flash-0731 to the OpenRouter whitelist; minimal, fully unit-tested, no paid inference calls) and #470 (Gonka provider for Kimi K2.6; larger, operator-controlled broker design). #469 in particular is a small low-risk addition that would immediately let miners evaluate against the new DeepSeek V4 Flash.

The ridges-agent-egress NetworkPolicy allowed UDP/TCP 53 to 0.0.0.0/0
(no `to:` selector). Agent pods could therefore query arbitrary
authoritative DNS servers, opening a DNS-tunneling channel out of the
sandbox: low-bandwidth, but enough to exfiltrate data or relay traffic
to non-whitelisted endpoints, bypassing the SNI allowlist that gates
port 443.

Scope DNS egress to kube-system (kube-dns / CoreDNS, and node-local-dns
DaemonSets where present), which is where every cluster's resolver
lives. Legitimate resolution is unaffected; the HTTPS path via the
iptables REDIRECT + SNI router is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant