Repository navigation
Conversation
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>
|
🌿 Preview your docs: https://nvidia-preview-pr-5793.docs.buildwithfern.com/openshell |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Carries @Joffref's #3702, rebased on current
mainwith his commits unchanged. Policy DNS answers AAAA queries on IPv6-only supervisor namespaces (policy_dns_ipv6_egress,autoby default), and SSRF checks treat a NAT64 address as the IPv4 address it embeds.Related Issue
Closes #3716
Supersedes #3702.
Changes
main.fix(supervisor): adapt IPv6 policy DNS egress to current main: useegress_emit!for the new config events, pass the newsupervisor_podandpreauthorize_transparent_openarguments, and move the IPv6 tests to thePolicyDnsServiceandpinned_addresses_forAPIs.Testing
cargo fmt, andcargo clippy -D warningson 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 8proxy::teststhat also fail onmainon 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 logsIPv6 egress enabled (requested auto, route state ipv6_only).Kubernetes (kind, dual-stack):
autostays disabled (route state dual_stack). Withpolicy_dns_ipv6_egress = "enabled", the same cases pass.e2e/rust/tests/policy_dns_ipv6_egress.rspasses on the dual-stack cluster withOPENSHELL_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