feat(traffic,sandbox): add TUN/netstack transparent gateway, egress controls, CAP_NET_RAW hardening, and i18n fixes

- Implement full-traffic transparent gateway (cmd/artex-gateway, traffic/netstack.go, traffic/transparent.go) using Linux TUN + gVisor netstack deferred TCP handshakes (eliminating nmap/nc false-positive open ports), real ICMPv4 Echo proxying, UDP/DNS interception, and per-container upstream proxy overrides.
- Add egress blacklist + asset-intercept sync, non-HTTP flow/DNS SQLite persistence and APIs, and /system/proxy & /function/traffic TCP/UDP/DNS UI panels.
- Fix sandbox Playwright MCP browser loopback --proxy-server rewrite and NODE_EXTRA_CA_CERTS override in server/mcpstdio.go.
- Strip all SUID/SGID binaries in Dockerfile.sandbox, grant minimal cap_net_raw+ep to nmap/nping/ping with ARTEX_SANDBOX_ALLOW_NET_RAW toggle, and enforce IPv4/IPv6 anti-spoofing in iptables and netstack.
- Remove hardcoded Chinese "(全局)" from GET /api/proxy/routes, localize ContainerRoutesTab / NonHTTPTrafficPanel labels, and expose reactive locale/isEn from useLiveTranslation for React Compiler compatibility.
This commit is contained in:
ji ruo committed 2026-12-02 02:51:36 +08:00
1 parent 9c43e694a3
commit d786de90af
69 files changed
+13082 -1433

No files matched your search

+22 -1
View File
@@ -32,9 +32,22 @@ if ! docker network inspect "$sandbox_net" >/dev/null 2>&1; then
fi
sandbox_br=$(bridge_for "$sandbox_net")
ensure INPUT -i "$sandbox_br" -p tcp --dport 8787 -j REJECT
# If the ARTEX control-plane container is directly attached to artex-sandbox
# (SNAT-free source IP attribution, #218), allow ONLY sandbox -> ARTEX :8788
# (plus established return packets) while keeping enable_icc=false between
# sandbox containers and explicitly rejecting :8787.
artex_ct=$(docker ps --filter "network=$sandbox_net" --format '{{.Names}}' | awk '/artex/ && !/artex-sbx-/ {print; exit}')
if [ -n "$artex_ct" ]; then
artex_sbx_ip=$(docker inspect "$artex_ct" --format "{{with index .NetworkSettings.Networks \"$sandbox_net\"}}{{.IPAddress}}{{end}}")
if [ -n "$artex_sbx_ip" ]; then
ensure DOCKER-USER -i "$sandbox_br" -o "$sandbox_br" -d "$artex_sbx_ip/32" -p tcp --dport 8787 -j REJECT
ensure DOCKER-USER -i "$sandbox_br" -o "$sandbox_br" -s "$artex_sbx_ip/32" -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
ensure DOCKER-USER -i "$sandbox_br" -o "$sandbox_br" -d "$artex_sbx_ip/32" -p tcp --dport 8788 -j ACCEPT
fi
fi
# Compose prefixes the internal network with the project name.
internal_net=$(docker network ls --format '{{.Name}}' | awk '/artex-internal$/ {print; exit}')
if [ -n "$internal_net" ]; then
@@ -50,4 +63,12 @@ fi
ensure DOCKER-USER -i "$sandbox_br" -d 169.254.169.254/32 -j REJECT
# Optional transparent gateway mode (#218 Phase 3): allow traffic routed into
# artex-tun0 (gVisor netstack) and reject any direct outbound NAT bypass.
if [ "${ARTEX_SANDBOX_TRANSPARENT:-false}" = "true" ] || [ "${ARTEX_SANDBOX_TRANSPARENT:-0}" = "1" ]; then
ensure DOCKER-USER -i "$sandbox_br" ! -o "$sandbox_br" -j REJECT
ensure DOCKER-USER -i "$sandbox_br" -o artex-tun0 -j ACCEPT
ensure DOCKER-USER -i artex-tun0 -o "$sandbox_br" -j ACCEPT
fi
echo "sandbox firewall applied on $sandbox_br"