Skip to content

feat(supervisor): IPv6 policy DNS egress and NAT64-aware SSRF checks - #5793

Open
FrostGod wants to merge 7 commits into
mainfrom
feat/3716-policy-dns-ipv6-egress/FrostGod
Open

FrostGod wants to merge 7 commits into
mainfrom
feat/3716-policy-dns-ipv6-egress/FrostGod

Conversation

@FrostGod

Copy link
Copy Markdown
Contributor

Summary

Carries @Joffref's #3702, rebased on current main with his commits unchanged. Policy DNS answers AAAA queries on IPv6-only supervisor namespaces (policy_dns_ipv6_egress, auto by default), and SSRF checks treat a NAT64 address as the IPv4 address it embeds.

Related Issue

Closes #3716

Supersedes #3702.

Changes

  • The 6 commits from feat(supervisor): IPv6 policy DNS egress and NAT64-aware SSRF checks #3702, with conflicts resolved against main.
  • fix(supervisor): adapt IPv6 policy DNS egress to current main: use egress_emit! for the new config events, pass the new supervisor_pod and preauthorize_transparent_open arguments, and move the IPv6 tests to the PolicyDnsService and pinned_addresses_for APIs.

Testing

  • cargo fmt, and cargo clippy -D warnings on the touched crates.

  • Unit tests for openshell-core, openshell-supervisor-network, and the Docker, Podman, Kubernetes, VM and gateway crates pass. The only failures are 8 proxy::tests that also fail on main on macOS.

  • Kubernetes (kind, IPv6-only): with dedicated and shared supervisors, sandbox egress by hostname to IPv6-only Services passes (exact host, allowed_ips, native TCP). The supervisor logs IPv6 egress enabled (requested auto, route state ipv6_only).

  • Kubernetes (kind, dual-stack): auto stays disabled (route state dual_stack). With policy_dns_ipv6_egress = "enabled", the same cases pass.

  • e2e/rust/tests/policy_dns_ipv6_egress.rs passes on the dual-stack cluster with OPENSHELL_E2E_EXPECT_ROUTE_STATE=dual_stack.

  • Checks appropriate to the affected code and behavior pass

  • Unit tests added/updated (if applicable)

  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

Joffref and others added 7 commits November 19, 2026 21:19
Mediated policy DNS always answered AAAA queries with NOERROR/NODATA and
resolved A queries upstream as A only. On IPv6-only hosts behind
NAT64/DNS64 the trusted resolver returns no A records, so every
policy-allowed name failed with policy_dns_upstream_no_data and native
TCP egress was unusable.

Add a driver-owned supervisor flag, --policy-dns-ipv6-egress
{auto,enabled,disabled}. The default auto mode enables AAAA answers only
when the supervisor network namespace has an IPv6 default route and no
IPv4 default route, so dual-stack and IPv4-only hosts keep the current
A-record fallback. AAAA answers use the existing epoch-scoped synthetic
IPv6 pool and are pinned and dialed through the same resolved-endpoint
store and destination validation as IPv4 answers.

Signed-off-by: Joffref <mjoffre@blaxel.ai>
…ings

A DNS64 answer like 64:ff9b::a00:5 is really 10.0.0.5, but the SSRF
checks treated it as a public IPv6 address. Addresses inside a NAT64
prefix are now checked as the IPv4 address they embed, in policy DNS
and in the CONNECT path. The well-known prefix is always known; other
prefixes come from the new nat64_prefixes driver setting, or from
ipv4only.arpa discovery when the supervisor starts.

policy_dns_ipv6_egress and nat64_prefixes can now be set in the Docker,
Podman, Kubernetes and VM driver configs. Before this, only auto was
reachable in practice.

The supervisor logs its IPv6 egress decision (requested mode, result,
default routes, route state) and the NAT64 prefixes it uses as OCSF
config events.

Tests: route detection fixtures per backend, a start_mediated test with
a fake mediation source and DNS64 upstream, driver arg tests, and an
e2e check of the decision event.

Signed-off-by: Joffref <mjoffre@blaxel.ai>
…S runtime

The listener-based runtime still started with IPv6 answers off, so an
explicit mode only reached the mediated runtime. Resolve the mode once and
use it for both.

Signed-off-by: Joffref <mjoffre@blaxel.ai>
…swers

allowed_ips entries now match a NAT64 address through the IPv4 address
it embeds, so 10.0.0.0/8 covers 64:ff9b::a00:5 the same way it covers
10.0.0.5. Loopback, link-local and metadata stay blocked first.

The mediated IPv6 test now also checks that these are denied: the real
upstream IPv6, an unallocated synthetic address, the right address on
the wrong port, an open without a binary identity, and the old mapping
after a policy reload. A second test covers an unreachable trusted
resolver. The store gets the IPv6 version of the wrong port / stale
generation / expiry test.

Signed-off-by: Joffref <mjoffre@blaxel.ai>
embedded_ipv4 returned the first registered prefix that contained the
address. With a configured 2001:db8::/32 and a later-discovered
2001:db8:8c52:7003::/96, 2001:db8:8c52:7003::7f00:1 was read through the
/32 as 140.82.112.3 and passed the SSRF checks, while the /96 route
translates it to 127.0.0.1.

Pick the longest matching prefix, the well-known prefix included, the
same way the route that carries the packet does. The tests register the
broad prefix first and check loopback, metadata and private destinations
under the nested one. They use RFC 9637 documentation space because the
registry is process-wide and a 2001:db8::/32 would change how other
tests classify their 2001:db8 addresses.

Signed-off-by: Joffref <mjoffre@blaxel.ai>
…test

Signed-off-by: Joffref <mjoffre@blaxel.ai>
Use egress_emit for the supervisor-network config events, pass the new
supervisor_pod and preauthorize_transparent_open arguments, and use the
PolicyDnsService and pinned_addresses_for APIs in the IPv6 tests.

Signed-off-by: divesh <dgude@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(network): support policy DNS IPv6 egress across the sandbox–supervisor boundary

2 participants