Repository navigation
Commit 87b5a1c
feat(supervisor): IPv6 policy DNS egress and NAT64-aware SSRF checks (#5793)
* feat(supervisor): make policy DNS IPv6 egress configurable
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>
* feat(supervisor): NAT64-aware SSRF checks and driver IPv6 egress settings
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>
* fix(supervisor): apply the IPv6 egress mode to the listener policy DNS 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>
* test(supervisor): IPv6 fail-closed cases and allowed_ips for NAT64 answers
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>
* fix(core): classify NAT64 addresses by the longest matching prefix
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>
* style(supervisor): satisfy clippy duration_suboptimal_units in NAT64 test
Signed-off-by: Joffref <mjoffre@blaxel.ai>
* fix(supervisor): adapt IPv6 policy DNS egress to current main
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>
* fix(supervisor): honor policy DNS IPv6 settings in shared supervisors
Shared supervisors gave every hosted instance auto mode and no NAT64
prefixes. They now take --policy-dns-ipv6-egress and --nat64-prefix like
dedicated supervisors, and the Helm chart renders both from the
Kubernetes driver settings.
Signed-off-by: divesh <dgude@nvidia.com>
---------
Signed-off-by: Joffref <mjoffre@blaxel.ai>
Signed-off-by: divesh <dgude@nvidia.com>
Co-authored-by: Joffref <mjoffre@blaxel.ai>1 parent 4fe0103 commit 87b5a1c
35 files changed
Lines changed: 2770 additions & 31 deletions
File tree
- crates
- openshell-core/src
- net
- openshell-driver-docker/src
- openshell-driver-kubernetes/src
- openshell-driver-podman/src
- openshell-driver-vm/src
- openshell-gateway/src
- openshell-supervisor-network/src
- policy_dns
- proxy
- openshell-supervisor/src
- backend_setup
- deploy/helm/openshell
- templates
- tests
- docs/how-it-works
- gateways
- policies
- e2e/rust/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1161 | 1161 | | |
1162 | 1162 | | |
1163 | 1163 | | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1164 | 1263 | | |
1165 | 1264 | | |
1166 | 1265 | | |
| |||
1585 | 1684 | | |
1586 | 1685 | | |
1587 | 1686 | | |
1588 | | - | |
1589 | | - | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
1590 | 1690 | | |
1591 | 1691 | | |
1592 | 1692 | | |
| |||
1827 | 1927 | | |
1828 | 1928 | | |
1829 | 1929 | | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
1830 | 1969 | | |
1831 | 1970 | | |
1832 | 1971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
0 commit comments