dnsbpf plugin, and a set of eBPF cgroup programs that enforce egress at the kernel — managed automatically by clawker on an isolated Docker bridge network. One firewall stack serves all clawker-managed containers on the host (1:N). It provides DNS-level blocking, per-domain TCP routing, and TLS-level inspection without granting your agent containers any special privileges.
This page is the reference for the firewall itself — architecture, configuration, and CLI commands. For why the firewall is the center of clawker’s defenses and the specific attacks it neutralizes (prompt injection, data exfiltration, DNS tunneling), see the Threat Model.
Architecture
The firewall is composed of two managed Docker containers plus a set of eBPF programs attached from outside each agent container:- Envoy (
envoyproxy/envoy, TLS listener10000, sequential TCP listeners from10001) — TLS termination with per-domain certificates for all allowed domains. Envoy terminates TLS, inspects HTTP traffic (paths, methods, response codes visible), then re-encrypts upstream. Default deny (connection reset) for unrecognized SNI. - CoreDNS (
clawker-coredns:latest, port53) — a custom CoreDNS build fromcmd/coredns-clawker. Provides deny-by-default DNS filtering (NXDOMAIN for anything not in the allowlist, Cloudflare malware-blocking upstream1.1.1.2/1.0.0.2) and embeds the first-partydnsbpfplugin that writes every resolved IP to the BPFdns_cachemap in real time — this is what lets the BPFconnect4/connect6programs do per-domain TCP routing. Its host access is scoped to the minimum needed to update that pinned cache map — see DNS cache population. - eBPF cgroup programs (
connect4,sendmsg4,recvmsg4,getpeername4,connect6,sendmsg6,recvmsg6,getpeername6,sock_create) — loaded and attached from outside the agent container by the clawker control plane. Owns the pinned BPF maps under/sys/fs/bpf/clawker/:container_map,route_map,dns_cache,bypass_map,udp_flow_map,metrics_map, plus the netlogger telemetry mapsevents_ringbuf(decision-point event channel),events_drops(kernel-fault drop counter),ratelimit_state(per-cgroup token bucket),ratelimit_drops(per-cgroup throttled-event counter). The agent container itself runs fully unprivileged — no Linux capabilities, no firewall scripts, no init-time network gymnastics. The control plane container that owns the load step runs withCAP_BPF + CAP_SYS_ADMIN, a/sys/fs/bpfRW bind mount, a/sys/fs/cgroupRO bind mount, the Docker socket, andapparmor=unconfined— see Control Plane → Container Privileges for the full set and why each is required.
clawker-net bridge network with deterministic static IPs computed from the network gateway by replacing its last octet: Envoy at <network>.200, CoreDNS at <network>.201 (so e.g. 192.168.215.200 / .201 on a default Docker bridge with gateway 192.168.215.1). Agent containers join the same network with --dns pointed at CoreDNS, and the eBPF connect4/connect6 programs redirect all outbound TCP to Envoy. CoreDNS forwards Docker internal names (host.docker.internal, monitoring stack containers) back to Docker’s embedded DNS at 127.0.0.11 so internal networking keeps working.
How It Works
- When you run
clawker runorclawker container createwith the firewall enabled, clawker brings the firewall stack up automatically (this happens transparently — see Control Plane if you want the lifecycle details). - The
clawker-netbridge network is created, the eBPF programs are loaded into the kernel and their maps pinned under/sys/fs/bpf/clawker/, then CoreDNS and Envoy are launched. CoreDNS opens the pinneddns_cachemap on startup, so the eBPF state must exist before CoreDNS boots — this ordering is preserved on every reload. - Project rules from
.clawker.yamlare merged with the selected harness’s egress floor rules (additive merge, dedup bydestination:protocol:port). - Envoy, CoreDNS, and the global
route_mapare (re)generated from the merged ruleset. - Agent containers join the firewall network; the eBPF cgroup programs attach to each container’s cgroup, and an entry is written to
container_map(cgroup_id → container config). Presence incontainer_mapis what gates enforcement — theroute_mapitself is global. - As the agent resolves DNS, the
dnsbpfplugin writesIP → {identity, TTL}entries into thedns_cachemap, where the identity is a per-destination route identity allocated by the control plane. On each outbound TCP connection, theconnect4/connect6programs look up the destination IP indns_cache, then look up{identity, dst_port}inroute_mapto decide which Envoy listener to redirect to. - Envoy and CoreDNS are health-probed continuously. When the last clawker-managed agent container exits, the firewall stack and eBPF state are drained and flushed cleanly.
- At every cgroup decision point, the BPF program also reserves a slot in the parallel
events_ringbufand writes the verdict + 4-tuple +cgroup_id. The CP-side netlogger drains the ringbuf, enriches each record bycgroup_idwith container/agent/project attribution, and emits one OTLP log record per decision. See Egress Observability for the record shape, attribute reference, and the OpenSearch index they land in.
Because
route_map is global, clawker firewall add, clawker firewall remove, and clawker firewall reload immediately propagate rule changes to all running agent containers via an atomic route-map sync — no agent restart, no firewall stack restart.IPv4, IPv6, and dual-stack
The BPFconnect6 program applies the full connect4 routing logic to IPv4-mapped IPv6 addresses (::ffff:x.x.x.x). Dual-stack clients — SSH, curl, Node.js, Go’s default resolver — use IPv4-mapped sockets, so they get the same per-domain routing through Envoy as native IPv4.
DNS cache population
Per-domain TCP routing depends on thedns_cache map staying consistent with the IPs a container actually dials, and the dnsbpf plugin keeps it consistent by tracking every query live rather than seeding the cache once at startup. A one-time seed would go stale as CDNs rotate backends behind a domain — silently blackholing traffic to an allowlisted domain until the next firewall reload. Because the plugin observes whatever the upstream resolver returns on each query, any IP a container ends up using has already been observed and hashed at the moment of connection.
The plugin only writes on successful A-record answers. NXDOMAIN and other non-success responses pass through untouched, so a blocked domain can never smuggle an attacker-controlled IP into the route table. The custom CoreDNS image is a small single-purpose build — the CoreDNS binary copied onto a SHA-pinned alpine:3.21 base, with no application dependencies beyond that single binary — and its host access is deliberately narrow: CAP_BPF + CAP_SYS_ADMIN scoped to the minimum needed for bpf(BPF_OBJ_GET) and bpf(BPF_MAP_UPDATE_ELEM) on the pinned map, with a /sys/fs/bpf bind mount as its only host access.
Default Allowed Domains (Harness Floors)
The default allowlist is the selected harness’s egress floor — each harness bundle declares the bare-minimum set of domains that harness needs (API access, authentication, telemetry), and clawker composes it with your project rules. The floor is deliberately bare-bones. The claude harness floor:
The codex harness floor:
Custom harness bundles declare their own floor in the manifest’s
egress: list, using the same rule shape as project security.firewall.rules.
A leading dot (e.g.,
.datadoghq.com) is the wildcard convention — it matches the apex domain and all subdomains. Use this for services with region-specific subdomains. Without the leading dot, only the exact domain is allowed.Common Setups
Here are examples for common services your agent will likely need. Add what you need to your.clawker.yaml (see the harness floors above for what is already included).
Git SSH (GitHub, GitLab, Bitbucket)
SSH git operations (git clone [email protected]:...) require an explicit SSH rule. The add_domains shorthand only covers HTTPS (port 443) — SSH needs a dedicated rules entry on port 22:
git push and git clone over SSH will fail with a connection reset. The agent’s SSH keys are forwarded from your host (see Credential Forwarding), but the firewall still needs to allow the traffic through.
For GitLab or Bitbucket, add equivalent rules:
Package Registries
Full Working Example
A typical project that uses GitHub and npm (the npm registry is already in the claude harness floor):Configuration
The firewall is configured in two places:- Global toggle:
firewall.enableinsettings.yaml(enable/disable the entire firewall) - Per-project rules:
security.firewallsection of.clawker.yaml(which domains to allow)
.clawker.yaml:
add_domains
A convenience shorthand for allowlisting entire domains. Each entry is automatically converted to an https allow rule on port 443 with no path restrictions (allow-all routing through TLS inspection).
.datadoghq.com) enables wildcard matching — the apex domain and all subdomains are allowed. Without the leading dot, only the exact domain is matched. Use wildcards for services with region-specific subdomains (e.g., Datadog’s us5.datadoghq.com, eu1.datadoghq.com).
rules
Full rule specification for fine-grained control:
Each
path_rules entry:
Protocol behavior
https(default) --- HTTPS traffic. Envoy terminates TLS with a per-domain certificate, inspects HTTP traffic (paths visible in access logs), then re-encrypts upstream. Withpath_rules, per-path routing is applied; withoutpath_rules, all traffic to the domain is allowed.wssis the WebSocket-over-TLS variant (same stack, WebSocket upgrade enabled per route).http--- Plain HTTP traffic. Envoy inspects the Host header for domain matching and applies path rules directly. No TLS involved.wsis the WebSocket-over-HTTP variant.udp--- Raw UDP datagrams. No domain or path inspection; each rule gets a dedicatedudp_proxylistener pinned to the rule’s host.tcp--- Raw TCP forwarding to a specific port. No domain or path inspection. See the port-level routing note below.ssh--- SSH traffic forwarding. Functionally identical totcpbut semantically distinct. See the port-level routing note below.
Path rules
Path rules give you fine-grained control over which URL paths are allowed for a domain. Envoy uses prefix matching --- a rule for/api/v1 matches /api/v1, /api/v1/users, /api/v1/models/list, etc.
When path_rules is specified, path_default controls what happens to paths that don’t match any rule. It defaults to deny, meaning only explicitly allowed paths get through.
Exact and pattern matching
Prefix matching is open-ended, which can let more through than you intend: anallow rule for /repos/myorg also matches /repos/myorg-evil. On a host where
the path embeds a name you don’t control (/repos/<user>, /u/<name>), that gap
is exploitable.
To match exactly, prefix the path with ~. The rest of the value is then a
regular expression matched against
the whole path, so it is anchored at both ends --- no open-ended tail:
The trailing slash is significant:
~/blog and ~/blog/ are different rules, so
match the form(s) your server actually serves (use the /? or (/.*)? tail if it
accepts both). Rules without ~ keep prefix behavior --- nothing changes for
existing rules.
A path must start with / (a regex must anchor at / or ^/); the firewall does
not guess. An invalid path --- a literal missing the leading /, a literal
containing characters that can’t appear in a URL path (often a regex written
without the leading ~), or a regex that won’t compile --- fails the whole
add/refresh operation with an error rather than silently loosening the rule.
When several rules match the same path, the longest rule string wins, and
equal-length matches fall to declaration order (first listed wins). A regex’s
“length” is its literal character count, not how much it matches --- so a
short, broad regex can lose to a longer, more specific literal and vice versa.
To force a particular winner among overlapping rules, list it first or make its
string longer.
When adding a regex path from the CLI, quote it --- the shell otherwise expands
~/ and treats (, |, ? as special:
/v1/chat/completions and /v1/models are forwarded. Everything else (e.g., /admin, /internal) gets a 403 Forbidden response.
Pattern 2: Deny specific paths, allow everything else
/evil, which get a 403.
Method gating
Because the firewall MITM-terminates HTTPS, the decrypted HTTP request line --- including the request method --- is visible at the proxy. A path rule’s optionalmethods field narrows its action to a set of HTTP verbs (GET, HEAD, POST, PUT, PATCH, DELETE, …). It is a match condition, not a separate verdict: action supplies the polarity, and methods not in the set fall through to later path rules or path_default.
- Empty
methods(the default) = the rule applies to all methods --- a rule with nomethodsfield is method-agnostic. action: allow+methods= allow-list those verbs (others fall through).action: deny+methods= deny-list those verbs (others fall through).- HTTP-family protos only (
https/http/ws/wss). Ontcp/ssh/udpthere is no HTTP request line, somethods(likepath_rules) is ignored with a warning.
methods field. To make a whole host read-only, use a single / path rule --- a path rule for / matches every request:
GET or HEAD to any path is forwarded; a POST/PUT/PATCH/DELETE matches no route and falls to path_default: deny → 403. This blocks git push (POST .../git-receive-pack) and contents-API writes (PUT|DELETE /repos/.../contents/...) without enumerating every write path.
The inverse --- block writes on a prefix while leaving reads open --- pairs action: deny with the mutating verbs:
clawker firewall add api.github.com --path / --action allow --methods GET,HEAD.
Mixed protocol examples:
Harness Floor vs Project Rules
- Harness floor rules come from the selected harness bundle’s
egress:list and are always present --- the domains that harness needs for API access, authentication, and telemetry - Project rules come from
add_domainsandrulesin your.clawker.yaml - Rules merge additively --- project rules add to (never replace) the harness floor
- Dedup key:
destination:protocol:port--- duplicate rules are silently ignored - This means you cannot accidentally override or remove a harness floor rule
CLI Commands
All firewall operations are available underclawker firewall:
Certificate Management
The firewall uses a self-signed certificate authority for TLS inspection. All HTTPS traffic is terminated at Envoy with per-domain certificates, inspected at the HTTP level (making request paths, methods, and response codes visible), then re-encrypted upstream.- An ECDSA P256 CA is auto-generated during
clawker buildand baked into agent container images viaupdate-ca-certificates - Per-domain certificates are generated for every
https/wssrule --- Envoy terminates TLS for all allowed TLS domains - Domains with
path_rulesget per-path routing; domains without get allow-all routing --- both go through TLS inspection - The CA keypair is persisted in the firewall data directory and shared between the bundler and firewall manager
- Use
clawker firewall rotate-cato regenerate the CA and all domain certs
After rotating the CA, you must restart any running agent containers for them to pick up the new certificate.
Tools with custom CA bundles
Some tools (notably Python packages installed viauv/uvx, like semgrep) ship their own CA certificate bundles and ignore the system trust store. Clawker sets SSL_CERT_FILE and CURL_CA_BUNDLE in the container environment to point these tools at the system store, which includes the firewall CA.
If a tool still reports certificate errors, it may need its own environment variable. Add it to your project config:
SSL_CERT_FILE and CURL_CA_BUNDLE are set automatically in the container. They point at the system CA bundle which includes the firewall CA. Use ${SSL_CERT_FILE} when configuring additional tools rather than hardcoding paths.Bypass (Escape Hatch)
For situations where you need temporary unrestricted network access:verdict=bypassed record (with attribution, destination 4-tuple, and resolved domain when available) for every connect/sendmsg/sock_create call that takes the bypass path. The records land in OpenSearch alongside allowed/denied decisions — see Egress Observability for the record shape and how to query them.
Disabling the Firewall
To disable the firewall entirely, setfirewall.enable to false in your settings.yaml (not the project config):
clawker-ebpf-egress OpenSearch index receives no new records while the firewall is off. See Egress Observability for the record shape.
Troubleshooting
Health check failures
Runclawker firewall status to see the health of the stack (Envoy, CoreDNS, and the eBPF subsystem). Envoy is probed over clawker-net on its internal health listener port 9902 (HTTP GET /), and CoreDNS is probed on its health port 18902 (HTTP GET /health). The eBPF subsystem is considered healthy when the pinned programs and maps under /sys/fs/bpf/clawker/ are present — they survive across firewall stack restarts by design.
If a container is unhealthy, try:
Blocked domains
Check which rules are active withclawker firewall list. If a domain you need is missing, add it:
.clawker.yaml:
.clawker.yaml only take effect on the next container start. To apply them to running agents without a restart, run clawker firewall refresh — it re-reads the current project’s config and syncs the new rules into the live store. (Sync is add/update only; domains you delete from the yaml are not pruned — use clawker firewall remove for a single rule, or clawker firewall prune to reset the whole store to what config defines.)
To attach a path-scoped rule onto an existing entry:
path is matched as a prefix at request time, unless it is prefixed with ~, which matches it as an anchored regex for exact matching (see Exact and pattern matching). Adds, updates, and removes look the entry up by exact-string match on path: repeating the same --path with a different --action overwrites that entry’s action; a different --path value appends a new entry. Use clawker firewall remove api.example.com --path /v1 to drop a single path rule without removing the whole entry.
DNS resolution failures
CoreDNS returns NXDOMAIN for any domain not in the allowlist. If an agent reports DNS failures for a domain it should be able to reach, verify the domain is in your rules withclawker firewall list.
Docker internal names (host.docker.internal, monitoring stack containers like otel-collector) are forwarded by CoreDNS back to Docker’s embedded DNS and should resolve automatically. If they don’t, check that CoreDNS is running on clawker-net with clawker firewall status.
Certificate trust errors
If an agent reports TLS certificate errors (CERTIFICATE_VERIFY_FAILED, unable to get local issuer certificate):
-
Check if the tool uses the system trust store. Most tools (Go, curl, wget) do. Python tools installed via
uv/uvxmay not --- see Tools with custom CA bundles above. - Rotate the CA if the certificate is expired or corrupted:
clawker build) and restart containers.
Stale dns_cache or route_map after upgrade
On startup the eBPF loader detects pinned maps whose key/value sizes have changed (for example, after a clawker upgrade that ships a new route_key layout) and removes them before reloading. If you still suspect a stale pin, bring the firewall fully down and back up: