You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5617bcf
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sandbox,podman): bind proxied CONNECT tunnels to validated addresses
The CONNECT request sent to the corporate proxy carried the destination
hostname, so the proxy resolved the name itself and the addresses that had
passed SSRF and allowed_ips validation were discarded. Split-horizon DNS
or rebinding at the proxy could then reach internal or otherwise
unapproved destinations through a tunnel the supervisor logged as
validated, and IP-range policy could not be enforced at all on proxied
dials.
CONNECT now targets a validated resolved address by default: the proxy
performs no DNS resolution and the tunnel stays bound to the answer the
supervisor checked. The hostname still travels inside the tunnel (TLS SNI,
application Host), so destination servers behave normally. In
split-horizon networks, operators point the gateway host at the corporate
resolver so internal names validate to their internal addresses.
For proxies whose ACLs filter on hostnames and reject IP CONNECT targets,
a new proxy_connect_by_hostname opt-in (CLI
--sandbox-proxy-connect-by-hostname, env
OPENSHELL_SANDBOX_PROXY_CONNECT_BY_HOSTNAME, reserved
OPENSHELL_UPSTREAM_PROXY_CONNECT_BY_HOSTNAME) restores hostname CONNECT,
documented as re-opening proxy-side resolution and making the proxy's ACLs
the effective egress control. Fail-closed pairing on both sides: the
opt-in without a proxy, or any value other than 'true', is fatal.
Adds regression coverage for the IP CONNECT request line (including IPv6
bracketing and hostname non-leakage), the hostname opt-in, and the
config pairing rules in driver and supervisor.
Signed-off-by: Philippe Martin <[email protected]>
Copy file name to clipboardExpand all lines: architecture/sandbox.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,10 +121,21 @@ resolution-aware: an entry with a `:port` qualifier only bypasses that port,
121
121
and IP/CIDR entries also match hostnames through their validated resolved
122
122
addresses, with the direct dial limited to the addresses the entry contains. Only `http://` proxy URLs in explicit
123
123
`http://host:port` form are supported — the scheme and port are both
124
-
required, and a path, query, or fragment is rejected. Local DNS resolution and SSRF validation still run before the
125
-
proxied dial; the CONNECT target sent to the corporate proxy is the requested
126
-
hostname. The workload child's proxy variables are unaffected — they are
127
-
always rewritten to point at the local policy proxy.
124
+
required, and a path, query, or fragment is rejected. Local DNS resolution
125
+
and SSRF validation still run before the proxied dial, and the CONNECT
126
+
target sent to the corporate proxy is a validated resolved address, so the
127
+
proxy performs no DNS resolution of its own and the tunnel stays bound to
128
+
the answer that passed SSRF and `allowed_ips` validation. The hostname still
129
+
travels inside the tunnel (TLS SNI, application `Host`). In split-horizon
130
+
networks, point the gateway host at the corporate resolver so internal names
131
+
validate to their internal addresses; the `proxy_connect_by_hostname`
132
+
opt-in (reserved `OPENSHELL_UPSTREAM_PROXY_CONNECT_BY_HOSTNAME`) exists as a
133
+
last resort for proxies whose ACLs filter on hostnames and reject IP CONNECT
134
+
targets — with it, the proxy resolves the name itself and its ACLs become
135
+
the effective egress control for proxied TLS. (Resolving through the proxy's
136
+
own DNS view, e.g. DoH tunneled via CONNECT, is a possible future
137
+
enhancement and out of scope.) The workload child's proxy variables are
138
+
unaffected — they are always rewritten to point at the local policy proxy.
128
139
129
140
The configuration is fail-closed: a reserved variable that is present but
130
141
invalid — a present-but-empty value, an unsupported or malformed proxy URL, an
Copy file name to clipboardExpand all lines: crates/openshell-driver-podman/README.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -349,6 +349,7 @@ Podman resources after out-of-band container removal or label drift.
349
349
|`OPENSHELL_SANDBOX_NO_PROXY`|`--sandbox-no-proxy`| unset | Comma-separated `NO_PROXY` list (hostnames, domain suffixes, IPs, CIDRs, each with an optional `:port` qualifier) dialed directly instead of through the corporate proxy. IP/CIDR entries also match hostnames through their validated DNS resolution. |
350
350
|`OPENSHELL_SANDBOX_PROXY_AUTH_FILE`|`--sandbox-proxy-auth-file`| unset | Path to a file containing the proxy credentials as `user:pass`. Staged as a root-only Podman secret so credentials never appear in config or container metadata. Requires the insecure-auth acknowledgement below. |
351
351
|`OPENSHELL_SANDBOX_PROXY_AUTH_ALLOW_INSECURE`|`--sandbox-proxy-auth-allow-insecure`| unset | Explicit acknowledgement (`true`) that the credential is sent as cleartext Basic auth over the plain-TCP connection to the `http://` proxy. Required when the auth file is set; rejected when it is not. |
352
+
|`OPENSHELL_SANDBOX_PROXY_CONNECT_BY_HOSTNAME`|`--sandbox-proxy-connect-by-hostname`| unset | Send the destination hostname in CONNECT requests instead of a validated IP. Last resort for proxies whose ACLs filter on hostnames: the proxy then resolves the name itself, so sandbox SSRF/`allowed_ips` validation no longer binds the connection. |
352
353
353
354
Through the gateway, the same settings are the `https_proxy`, `no_proxy`, and
354
355
`proxy_auth_file` keys under `[openshell.drivers.podman]`; see
0 commit comments