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
As of v0.13.13, chroot mode mounts a fresh container-scoped procfs at `/host/proc` to support Java and .NET runtimes:
86
+
87
+
**Why this is needed:**
88
+
- Java's JVM requires access to `/proc/cpuinfo` for CPU detection
89
+
- .NET's CLR requires `/proc/self/exe` to resolve the runtime binary path
90
+
- Static bind mounts of `/proc/self` always resolve to the parent shell, not the current process
91
+
92
+
**How it works:**
93
+
1. Before chroot, the entrypoint mounts a fresh procfs: `mount -t proc -o nosuid,nodev,noexec proc /host/proc`
94
+
2. This requires `CAP_SYS_ADMIN` capability, which is granted during container startup
95
+
3. The procfs is container-scoped, showing only container processes (not host processes)
96
+
4.`CAP_SYS_ADMIN` is dropped via capsh before executing user commands
97
+
98
+
**Security implications:**
99
+
- The mounted procfs only exposes container processes, not host processes
100
+
- Mount operation completes before user code runs (capability dropped)
101
+
- procfs is mounted with security restrictions: `nosuid,nodev,noexec`
102
+
- User code cannot unmount or remount (no `CAP_SYS_ADMIN`, umount blocked in seccomp)
103
+
104
+
**Backwards compatibility:**
105
+
- Existing code continues to work without changes
106
+
- Java and .NET commands now succeed in chroot mode (previously failed with cryptic errors)
107
+
- No impact on non-chroot mode
108
+
82
109
## Usage
83
110
84
111
### Basic Usage
@@ -164,7 +191,8 @@ In chroot mode, selective paths are mounted for security instead of the entire f
164
191
| `/etc/ca-certificates` | `/host/etc/ca-certificates:ro` | CA certificates |
165
192
| `/etc/passwd` | `/host/etc/passwd:ro` | User lookup |
166
193
| `/etc/group` | `/host/etc/group:ro` | Group lookup |
167
-
| `/proc/self` | `/host/proc/self:ro` | Process self-info (needed by Go) |
194
+
195
+
**Note:** As of v0.13.13, `/proc` is no longer bind-mounted. Instead, a fresh container-scoped procfs is mounted at `/host/proc` during entrypoint initialization. This provides dynamic `/proc/self/exe` resolution required by Java and .NET runtimes.
168
196
169
197
### Read-Write Mounts
170
198
@@ -190,10 +218,13 @@ The container starts with capabilities needed for setup, then drops them before
**Note:** `CAP_SYS_ADMIN` is only granted in chroot mode (v0.13.13+) for mounting procfs. It's dropped immediately after mount completes, before user commands run.
Copy file name to clipboardExpand all lines: docs/environment.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,12 @@ awf --env-all 'command'
17
17
18
18
When using `sudo -E`, these host variables are automatically passed: `GITHUB_TOKEN`, `GH_TOKEN`, `GITHUB_PERSONAL_ACCESS_TOKEN`, `USER`, `TERM`, `HOME`, `XDG_CONFIG_HOME`.
19
19
20
-
The following are always set/overridden: `HTTP_PROXY`, `HTTPS_PROXY` (Squid proxy), `PATH` (container values).
20
+
The following are always set/overridden: `PATH` (container values).
21
21
22
22
Variables from `--env` flags override everything else.
23
23
24
+
**Note:** As of v0.13.5, `HTTP_PROXY` and `HTTPS_PROXY` are no longer automatically set. Traffic is transparently redirected to Squid via iptables NAT rules. If needed, you can still set these manually with `--env HTTP_PROXY=...`
25
+
24
26
## Security Warning: `--env-all`
25
27
26
28
Using `--env-all` passes all host environment variables to the container, which creates security risks:
@@ -30,7 +32,9 @@ Using `--env-all` passes all host environment variables to the container, which
30
32
3.**Unnecessary Access**: Extra variables increase attack surface (violates least privilege)
31
33
4.**Accidental Sharing**: Easy to forget what's in your environment when sharing commands
**Proxy variables:** Host proxy settings are excluded to prevent conflicts with iptables-based traffic redirection. The firewall uses transparent proxying via iptables NAT rules instead of environment variable-based proxy configuration.
34
38
35
39
## Best Practices
36
40
@@ -58,13 +62,14 @@ The following environment variables are set internally by the firewall and used
58
62
| Variable | Description | Example |
59
63
|----------|-------------|---------|
60
64
|`AWF_DNS_SERVERS`| Comma-separated list of trusted DNS servers |`8.8.8.8,8.8.4.4`|
61
-
|`HTTP_PROXY`| Squid proxy URL for HTTP traffic |`http://172.30.0.10:3128`|
62
-
|`HTTPS_PROXY`| Squid proxy URL for HTTPS traffic |`http://172.30.0.10:3128`|
**Note:** These are set automatically based on CLI options and should not be overridden manually.
67
70
71
+
**Historical note:** Prior to v0.13.5, `HTTP_PROXY` and `HTTPS_PROXY` were set to point to Squid. These have been removed in favor of transparent iptables-based redirection, which is more reliable and avoids conflicts with tools that don't honor proxy environment variables.
72
+
68
73
## Troubleshooting
69
74
70
75
**Variable not accessible:** Use `sudo -E` or pass explicitly with `--env VAR="$VAR"`
Copy file name to clipboardExpand all lines: docs/usage.md
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -322,12 +322,13 @@ sudo awf \
322
322
323
323
### Security Considerations
324
324
325
-
> ⚠️ **Security Warning**: When `--enable-host-access` is combined with `host.docker.internal` in `--allow-domains`, containers can access **ANY service** running on the host machine, including:
326
-
> - Local databases (PostgreSQL, MySQL, Redis)
327
-
> - Development servers
328
-
> - Other sensitive services
325
+
> ⚠️ **Security Warning**: When `--enable-host-access` is enabled, containers can access services running on the host machine via `host.docker.internal`.
329
326
>
330
-
> Only enable this for trusted workloads like MCP gateways.
327
+
> **Port restrictions:** As of v0.13.13+, access is restricted to ports 80, 443, and any ports specified with `--allow-host-ports`. This prevents access to arbitrary services like databases, admin panels, etc.
328
+
>
329
+
> **Before v0.13.13:** All ports were accessible when host access was enabled, creating a security risk.
330
+
>
331
+
> Only enable this for trusted workloads like MCP gateways or local testing with Playwright.
331
332
332
333
**Why opt-in?** By default, `host.docker.internal` hostname resolution is disabled to prevent containers from accessing host services. This is a defense-in-depth measure against malicious code attempting to access local resources.
333
334
@@ -337,13 +338,16 @@ sudo awf \
337
338
# Start your MCP gateway on the host (port 8080)
338
339
./my-mcp-gateway --port 8080 &
339
340
340
-
# Run awf with host access enabled
341
+
# Run awf with host access enabled and custom port
**Note:** Ports 80 and 443 are always allowed when `--enable-host-access` is enabled. Use `--allow-host-ports` to allow additional ports (e.g., for MCP gateways or development servers running on non-standard ports).
350
+
347
351
### CONNECT Method on Port 80
348
352
349
353
The firewall allows the HTTP CONNECT method on both ports 80 and 443. This is required because some HTTP clients (e.g., Node.js fetch) use the CONNECT method even for HTTP connections when going through a proxy. Domain ACLs remain the primary security control.
0 commit comments