# network log: what this folder's VM's proxy allowed and blocked, the last N, or # the blocks by host with the command that allows each. # No VM: nothing to show. project net ! exec devvm network log stderr '^devvm: no_vm dir=\S*/net$' # A VM with network policy that logged nothing yet. exec devvm --network allowlist --no-git-protect vm_name NET net env LOG=$NET_dir/logs/network.jsonl exec devvm network log stdout '^==> log_empty vm=devvm-net-[0-9a-f]{14}$' ! stderr . exec devvm network log --json stdout '\A{\n "version": 1,\n "events": \[\]\n}\n\z' ! stderr . # Allowed and blocked connections and requests, oldest first, the last 50 # or the last N. exec sh -c 'mkdir -p "$NET_dir/logs" && cp "$WORK/events.jsonl" "$LOG"' exec devvm network log cmp stdout $WORK/log.txt ! stderr . exec devvm network log -n 2 stdout '\A2026-10-09T10:01:00Z BLOCKED a.test:443 not on the allowlist\n2026-10-09T10:02:00Z BLOCKED db.test:5432 not on the allowlist\n\z' exec devvm network log --lines 0 ! stdout . ! exec devvm network log -n x stderr '^devvm: flag_bad_value flag=--lines form=N value=x$' ! exec devvm network log -n -1 stderr '^devvm: flag_bad_value flag=--lines form=N value=-1$' # --json: the events as the proxy logged them, without the VM's name; # never followed. exec devvm network log --json -n 3 stdout '\A{\n "version": 1,\n "events": \[\n {\n "time": "2026-10-09T10:00:08Z",\n "event": "tunnel",\n "host": "fd00::1",\n "port": 22,\n "method": "CONNECT",\n "rule": "\[fd00::1\]:22"\n },\n' ! stdout '"vm"' ! exec devvm network log --json --follow stderr '^devvm: flags_exclusive flag=--(json|follow) other=--(json|follow)$' # The blocks by host and port, by when last blocked, with the command # that allows each: only for a host name or address, and never for a # request refused whatever the allowlist says. exec devvm network log --blocked cmp stdout $WORK/blocked.txt exec devvm network log --blocked --json stdout '\A{\n "version": 1,\n "blocked": \[\n {\n "last": "2026-10-09T10:00:07Z",\n "count": 1,\n "host": "api.github.com",\n "port": 443\n },\n' stdout '^ "last": "2026-10-09T10:01:00Z",\n "count": 2,\n "host": "a.test",\n "port": 443,\n "allow": "a.test"\n' ! exec devvm network log --blocked --follow stderr '^devvm: flags_exclusive flag=--blocked other=--follow$' # -f is --force's, never --follow's. ! exec devvm network log -f stderr '^devvm: flag_unknown command=devvm network log flag=-f$' # A log its proxy rotated: the old file's events come first, so the # history and the blocks are the same; one just rotated isn't empty. exec sh -c 'head -n 5 "$WORK/events.jsonl" > "$LOG.1" && tail -n +6 "$WORK/events.jsonl" > "$LOG"' exec devvm network log cmp stdout $WORK/log.txt exec devvm network log --blocked cmp stdout $WORK/blocked.txt exec sh -c 'cp "$WORK/events.jsonl" "$LOG.1" && : > "$LOG"' exec devvm network log -n 1 stdout '\A2026-10-09T10:02:00Z BLOCKED db.test:5432 not on the allowlist\n\z' rm $LOG.1 # A host and reason from the VM with control characters: dropped. cp $WORK/evil.jsonl $LOG exec devvm network log --blocked cmp stdout $WORK/evil-blocked.txt exec devvm network log cmp stdout $WORK/evil.txt # An open VM logs only what goes through its proxy, and devvm says so. project off exec devvm --network open --no-git-protect exec devvm network log stdout '^==> log_empty vm=devvm-off-[0-9a-f]{14}$' stderr '^net_open_log vm=devvm-off-[0-9a-f]{14}$' -- events.jsonl -- {"time":"2026-10-09T10:00:00Z","vm":"x","event":"blocked","host":"a.test","port":443,"method":"CONNECT","reason":"not on the allowlist"} {"time":"2026-10-09T10:00:05Z","vm":"x","event":"tunnel","host":"ok.test","port":443,"method":"CONNECT","rule":"ok.test"} {"time":"2026-10-09T10:00:06Z","vm":"x","event":"intercept","host":"api.github.com","port":443,"method":"CONNECT","rule":"*.github.com"} {"time":"2026-10-09T10:00:06Z","vm":"x","event":"forward","host":"api.github.com","port":443,"method":"GET","path":"/user","rule":"api.github.com GET /user","secrets":["github"]} {"time":"2026-10-09T10:00:07Z","vm":"x","event":"blocked","host":"api.github.com","port":443,"method":"POST","path":"/user/keys","reason":"makes an account key","refused":true} not an event {"time":"2026-10-09T10:00:08Z","vm":"x","event":"tunnel","host":"fd00::1","port":22,"method":"CONNECT","rule":"[fd00::1]:22"} {"time":"2026-10-09T10:01:00Z","vm":"x","event":"blocked","host":"a.test","port":443,"method":"CONNECT","reason":"not on the allowlist"} {"time":"2026-10-09T10:02:00Z","vm":"x","event":"blocked","host":"db.test","port":5432,"method":"CONNECT","reason":"not on the allowlist"} -- log.txt -- 2026-10-09T10:00:00Z BLOCKED a.test:443 not on the allowlist 2026-10-09T10:00:05Z allowed ok.test:443 rule ok.test 2026-10-09T10:00:06Z allowed api.github.com:443 rule *.github.com, decrypted 2026-10-09T10:00:06Z allowed api.github.com:443 GET /user, rule api.github.com GET /user, token: github 2026-10-09T10:00:07Z BLOCKED api.github.com:443 POST /user/keys: makes an account key 2026-10-09T10:00:08Z allowed [fd00::1]:22 rule [fd00::1]:22 2026-10-09T10:01:00Z BLOCKED a.test:443 not on the allowlist 2026-10-09T10:02:00Z BLOCKED db.test:5432 not on the allowlist -- blocked.txt -- LAST COUNT HOST ALLOW WITH 2026-10-09T10:00:07Z 1 api.github.com:443 - 2026-10-09T10:01:00Z 2 a.test:443 devvm network allow a.test 2026-10-09T10:02:00Z 1 db.test:5432 devvm network allow db.test:5432 -- evil.jsonl -- {"time":"2026-10-09T10:00:00Z","vm":"x","event":"blocked","host":"x;sh*","port":443,"method":"CONNECT","reason":"not on the allowlist"} {"time":"2026-10-09T10:00:01Z","vm":"x","event":"blocked","host":"e\u001b]0;x\u0007vil.test","port":443,"method":"CONNECT","reason":"r\u009bm\nfake"} -- evil-blocked.txt -- LAST COUNT HOST ALLOW WITH 2026-10-09T10:00:00Z 1 x;sh*:443 - 2026-10-09T10:00:01Z 1 e]0;xvil.test:443 - -- evil.txt -- 2026-10-09T10:00:00Z BLOCKED x;sh*:443 not on the allowlist 2026-10-09T10:00:01Z BLOCKED e]0;xvil.test:443 rmfake