Skip to content

Commit 283019c

Browse files
CopilotMossaka
andauthored
docs: add missing container configuration flags to CLI reference (#1610)
* Initial plan * docs: add missing container configuration flags to CLI reference Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/3205fc6a-2852-4cee-bc87-7ada09a9761e Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> * docs: address review feedback on CLI reference Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/3205fc6a-2852-4cee-bc87-7ada09a9761e Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
1 parent ba22061 commit 283019c

File tree

1 file changed

+134
-1
lines changed

1 file changed

+134
-1
lines changed

docs-site/src/content/docs/reference/cli-reference.md

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ awf [options] -- <command>
2121
|--------|------|---------|-------------|
2222
| `--allow-domains <domains>` | string || Comma-separated list of allowed domains (optional; if not specified, all network access is blocked) |
2323
| `--allow-domains-file <path>` | string || Path to file containing allowed domains |
24+
| `--ruleset-file <path>` | string | `[]` | YAML rule file for domain allowlisting (repeatable) |
2425
| `--block-domains <domains>` | string || Comma-separated list of blocked domains (takes precedence over allowed) |
2526
| `--block-domains-file <path>` | string || Path to file containing blocked domains |
2627
| `--ssl-bump` | flag | `false` | Enable SSL Bump for HTTPS content inspection |
2728
| `--allow-urls <urls>` | string || Comma-separated list of allowed URL patterns (requires `--ssl-bump`) |
2829
| `--log-level <level>` | string | `info` | Logging verbosity: `debug`, `info`, `warn`, `error` |
2930
| `--keep-containers` | flag | `false` | Keep containers running after command exits |
31+
| `--agent-timeout <minutes>` | number | no limit | Maximum time in minutes for the agent command to run |
3032
| `--tty` | flag | `false` | Allocate pseudo-TTY for interactive tools |
3133
| `--work-dir <dir>` | string | `/tmp/awf-<timestamp>` | Working directory for temporary files |
3234
| `--build-local` | flag | `false` | Build containers locally instead of pulling from registry |
@@ -36,11 +38,14 @@ awf [options] -- <command>
3638
| `-e, --env <KEY=VALUE>` | string | `[]` | Environment variable (repeatable) |
3739
| `--env-all` | flag | `false` | Pass all host environment variables |
3840
| `--exclude-env <name>` | string | `[]` | Exclude a variable from `--env-all` passthrough (repeatable) |
41+
| `--env-file <path>` | string || Read env vars from a file (KEY=VALUE format, one per line) |
3942
| `-v, --mount <host:container[:mode]>` | string | `[]` | Volume mount (repeatable) |
4043
| `--container-workdir <dir>` | string | User home | Working directory inside container |
44+
| `--memory-limit <limit>` | string | `6g` | Memory limit for the agent container |
4145
| `--dns-servers <servers>` | string | Auto-detected | Trusted DNS servers (comma-separated; auto-detected from host, falls back to `8.8.8.8,8.8.4.4`) |
4246
| `--dns-over-https [resolver-url]` | optional string | `https://dns.google/dns-query` | Enable DNS-over-HTTPS via sidecar proxy |
4347
| `--proxy-logs-dir <path>` | string || Directory to save Squid proxy logs to |
48+
| `--audit-dir <path>` | string || Directory for firewall audit artifacts |
4449
| `--enable-host-access` | flag | `false` | Enable access to host services via host.docker.internal |
4550
| `--allow-host-ports <ports>` | string | `80,443` | Ports to allow when using --enable-host-access |
4651
| `--allow-host-service-ports <ports>` | string || Ports to allow ONLY to host gateway (for GitHub Actions `services:`) |
@@ -96,6 +101,40 @@ Path to file with allowed domains. Supports comments (`#`) and one domain per li
96101
--allow-domains-file ./allowed-domains.txt
97102
```
98103

104+
### `--ruleset-file <path>`
105+
106+
YAML rule file for domain allowlisting. Can be specified multiple times to load multiple files. Domains from ruleset files are merged with `--allow-domains` and `--allow-domains-file`.
107+
108+
```bash
109+
# Single ruleset file
110+
--ruleset-file ./domains.yml
111+
112+
# Multiple ruleset files
113+
--ruleset-file ./base-domains.yml --ruleset-file ./extra-domains.yml
114+
```
115+
116+
**Schema** (version 1):
117+
118+
```yaml
119+
version: 1
120+
rules:
121+
- domain: github.com
122+
subdomains: true # default: true — also allows *.github.com
123+
- domain: example.com
124+
subdomains: false # exact match only
125+
```
126+
127+
**Fields:**
128+
- `version` — Must be `1`
129+
- `rules` — Array of rule objects
130+
131+
Each rule has the following fields:
132+
133+
| Field | Required | Default | Description |
134+
|-------|----------|---------|-------------|
135+
| `domain` | Yes | — | Domain name to allow |
136+
| `subdomains` | No | `true` | Whether to also allow all subdomains |
137+
99138
### `--block-domains <domains>`
100139

101140
Comma-separated list of blocked domains. **Blocked domains take precedence over allowed domains**, enabling fine-grained control. Supports the same wildcard patterns as `--allow-domains`.
@@ -176,6 +215,24 @@ Keep containers and configuration files after command exits for debugging.
176215
Requires manual cleanup: `docker stop awf-squid awf-agent && docker network rm awf-net`
177216
:::
178217

218+
### `--agent-timeout <minutes>`
219+
220+
Maximum time in minutes for the agent command to run. When the timeout is reached, the agent container is stopped and the firewall exits. Must be a positive integer.
221+
222+
```bash
223+
# Allow up to 30 minutes
224+
sudo awf --agent-timeout 30 --allow-domains github.com \
225+
-- long-running-command
226+
227+
# Allow up to 2 hours
228+
sudo awf --agent-timeout 120 --allow-domains github.com \
229+
-- npx @github/copilot@latest --prompt "complex task"
230+
```
231+
232+
:::note
233+
By default, there is no time limit. Use this flag to prevent runaway agent processes.
234+
:::
235+
179236
### `--tty`
180237

181238
Allocate a pseudo-TTY for interactive tools (e.g., Claude Code, interactive shells).
@@ -234,9 +291,47 @@ Pass environment variable to container. Can be specified multiple times.
234291
Pass all host environment variables to container.
235292

236293
:::danger[Security Risk]
237-
May expose sensitive credentials. Prefer `-e` for specific variables.
294+
May expose sensitive credentials. Prefer `-e` for specific variables, or use `--exclude-env` to filter out sensitive variables.
238295
:::
239296

297+
### `--exclude-env <name>`
298+
299+
Exclude a specific environment variable from `--env-all` passthrough. Can be specified multiple times. Only meaningful when used with `--env-all`.
300+
301+
```bash
302+
# Pass all env vars except secrets
303+
sudo -E awf --env-all \
304+
--exclude-env AWS_SECRET_ACCESS_KEY \
305+
--exclude-env GITHUB_TOKEN \
306+
--allow-domains github.com \
307+
-- my-command
308+
```
309+
310+
:::tip[Security Best Practice]
311+
When using `--env-all`, always exclude sensitive variables like API keys, tokens, and credentials with `--exclude-env`.
312+
:::
313+
314+
### `--env-file <path>`
315+
316+
Read environment variables from a file. The file uses `KEY=VALUE` format with one variable per line. Lines starting with `#` are treated as comments.
317+
318+
```bash
319+
sudo awf --env-file ./env.production \
320+
--allow-domains github.com \
321+
-- my-command
322+
```
323+
324+
**File format:**
325+
```bash
326+
# Database configuration
327+
DB_HOST=localhost
328+
DB_PORT=5432
329+
330+
# API settings
331+
API_KEY=your-api-key-here
332+
DEBUG=true
333+
```
334+
240335
### `-v, --mount <host_path:container_path[:mode]>`
241336

242337
Mount host directories into container. Format: `host_path:container_path[:ro|rw]`
@@ -260,6 +355,26 @@ Mount host directories into container. Format: `host_path:container_path[:ro|rw]
260355

261356
Working directory inside the container.
262357

358+
### `--memory-limit <limit>`
359+
360+
Memory limit for the agent container. Format: `<number><unit>` where unit is `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes).
361+
362+
- **Default**: `6g`
363+
364+
```bash
365+
# Increase memory for large language model agents
366+
sudo awf --memory-limit 8g --allow-domains github.com \
367+
-- memory-intensive-command
368+
369+
# Reduce memory for lightweight tasks
370+
sudo awf --memory-limit 2g --allow-domains github.com \
371+
-- curl https://api.github.com
372+
```
373+
374+
:::tip
375+
If your agent process is being killed unexpectedly (OOM), try increasing the memory limit with `--memory-limit 8g` or higher.
376+
:::
377+
263378
### `--dns-servers <servers>`
264379

265380
Comma-separated list of trusted DNS servers. DNS traffic is **only** allowed to these servers, preventing DNS-based data exfiltration. Both IPv4 and IPv6 addresses are supported.
@@ -380,6 +495,24 @@ cat ./firewall-logs/access.log
380495

381496
**Note:** The directory must be writable by the current user.
382497

498+
### `--audit-dir <path>`
499+
500+
Directory for firewall audit artifacts. When specified, the firewall saves configuration files, the policy manifest, and iptables state to this directory for compliance and debugging purposes.
501+
502+
```bash
503+
# Save audit artifacts
504+
sudo awf --audit-dir ./audit \
505+
--allow-domains github.com \
506+
-- curl https://api.github.com
507+
508+
# Review audit artifacts
509+
ls ./audit/
510+
```
511+
512+
:::tip
513+
Use `--audit-dir` in CI/CD pipelines to capture firewall configuration for audit trails. Can also be set via the `AWF_AUDIT_DIR` environment variable.
514+
:::
515+
383516
### `--agent-image <value>`
384517

385518
Specify the agent container image to use. Supports pre-built presets or custom base images.

0 commit comments

Comments
 (0)