mirror of
https://github.com/openai/codex.git
synced 2026-11-17 22:10:37 +00:00
## Why Native TCP clients need to reach managed network destinations without implementing proxy support themselves. ## What changed - Add `--transparent-tcp` to the Linux sandbox command, using a bundled TCP stack, private TUN interface, and DNS stub to route native IPv4 and IPv6 connections through the attributed managed SOCKS proxy. - Preserve original hostnames for proxy policy checks and cancel pending approval connections when their native sockets close. - Expose `--linux-sandbox-transparent-tcp` and `--tcp-upstream-proxy` on `codex exec-server` for transparent routing and a mandatory HTTP CONNECT next hop without direct fallback. - Require private network and PID namespaces, private procfs, system `bwrap`, and access to `/dev/net/tun`; reject incompatible launcher options and untrusted proxy ports. ## Testing Add integration coverage for native hostname and IPv6 connections, SOCKS attribution, pending connection cancellation, policy denials, and filesystem and host-loopback isolation. Extend launcher and executor tests for option validation and managed-policy propagation. GitOrigin-RevId: 96bd7726e5369efceb65320face56aa85ae3deb8
57 lines
1.4 KiB
Rust
57 lines
1.4 KiB
Rust
//! Linux sandbox helper entry point.
|
|
//!
|
|
//! On Linux, `codex-linux-sandbox` applies:
|
|
//! - in-process restrictions (`no_new_privs` + seccomp), and
|
|
//! - bubblewrap for filesystem isolation.
|
|
#[cfg(target_os = "linux")]
|
|
mod bazel_bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod bundled_bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod bwrap;
|
|
#[cfg(target_os = "linux")]
|
|
mod daemon_mounts;
|
|
#[cfg(target_os = "linux")]
|
|
mod exec_util;
|
|
#[cfg(target_os = "linux")]
|
|
mod fd_mount;
|
|
#[cfg(target_os = "linux")]
|
|
mod launcher;
|
|
#[cfg(target_os = "linux")]
|
|
mod linux_run_main;
|
|
#[cfg(target_os = "linux")]
|
|
mod managed_tcp;
|
|
#[cfg(target_os = "linux")]
|
|
mod managed_tcp_dns;
|
|
#[cfg(target_os = "linux")]
|
|
mod proxy_lifecycle;
|
|
#[cfg(target_os = "linux")]
|
|
mod proxy_routing;
|
|
#[cfg(target_os = "linux")]
|
|
mod seccomp;
|
|
#[cfg(target_os = "linux")]
|
|
mod tcp_namespace;
|
|
#[cfg(target_os = "linux")]
|
|
mod tcp_net_setup;
|
|
#[cfg(target_os = "linux")]
|
|
mod wslg;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
pub use bundled_bwrap::find_bundled_bwrap_for_exe;
|
|
#[cfg(target_os = "linux")]
|
|
pub use bwrap::expand_unreadable_globs;
|
|
|
|
/// Exit status returned when bundled bubblewrap fails digest verification.
|
|
#[cfg(target_os = "linux")]
|
|
pub const BUNDLED_BWRAP_DIGEST_VERIFICATION_FAILURE_EXIT_CODE: i32 = 8;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
pub fn run_main() -> ! {
|
|
linux_run_main::run_main();
|
|
}
|
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
pub fn run_main() -> ! {
|
|
panic!("codex-linux-sandbox is only supported on Linux");
|
|
}
|