apex-twin --proxy 8798 puts the gate in front of clients that do not speak MCP: curl -x, a browser, an agent's fetch. Bind is loopback only. - absolute-URI HTTP requests are parsed, checked with apex_scope_check() BEFORE the origin socket is opened, audited, and forwarded with the request line rewritten to origin form; headers lose Proxy-Connection/Connection and gain Connection: close; - Content-Length bodies are forwarded; chunked request bodies are refused with 501 rather than silently truncated; - the exchange is stored through the same traffic store as http_capture, so proxied and explicit captures sit together; - CONNECT is tunnelled blind and recorded as metadata (host, port, bytes), because this binary links no TLS stack; a half-close is propagated with shutdown so the tunnel ends when the client does; - out of scope -> 403 with the gate's reason in the body and a deny line in audit.log. The gate-bypass sabotage was seen red: with proxy_gate() skipped, the out-of-scope request went out, 403 became 502, and the audit had no deny - three checks failed. 197 checks, 40 tools. New systemd/apex-twin-proxy.service, loopback port, no CAP_NET_RAW. Parser stores numbers unquoted; the proxy is serial on purpose.
25 lines
746 B
Desktop File
25 lines
746 B
Desktop File
[Unit]
|
|
Description=APEX TWIN scope-gated forward proxy (loopback)
|
|
Documentation=file:/usr/local/share/doc/apex-twin/README.md
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=lotherk
|
|
# The proxy does not touch the radio, so no dialout here.
|
|
Environment=APEX_HOME=/home/lotherk/stack/data/apex-twin
|
|
EnvironmentFile=-/home/lotherk/.config/apex-twin/env
|
|
ExecStart=/usr/local/bin/apex-twin --proxy 8798
|
|
Restart=on-failure
|
|
RestartSec=3
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
ProtectHome=read-only
|
|
PrivateTmp=yes
|
|
ReadWritePaths=/home/lotherk/stack/data/apex-twin
|
|
# loopback only; no CAP_NET_RAW, no CAP_NET_ADMIN, no device nodes
|
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_NET_ADMIN CAP_NET_RAW
|
|
|
|
[Install]
|
|
WantedBy=default.target
|