# Workstation reach audit

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Give a workstation an audit egress policy to record the destinations it reaches, then turn the records into a strict allowlist.


Give a workstation an `audit` egress policy to record the destinations it reaches, then turn the
records into a `strict` allowlist. An audit policy enforces no destination. It sends the
workstation's connections through an Edge, which counts each connection it lets through. Use it
when you don't know which destinations a workstation needs.

## Audit recording

A workstation records its allowed connections while its policy is `audit`. Its
`status.egress.recorded` lists `allowed` once recording has started. Recording stops once the
policy is no longer `audit`. The exception is a workstation that an administrator's Edge records
for, as
[Turn on recording of allowed connections](https://docs.ringleader.dev/security/outbound/connection-records/#turn-on-recording-of-allowed-connections)
shows. [Connection records and traffic totals](https://docs.ringleader.dev/security/outbound/connection-records/)
says what each record holds and how long Ringleader keeps it.

An `audit` workstation is recorded, and lists `allowed`, only once the build that serves it matches
the one your Ringleader release delivers. Until then it records nothing and does not list
`allowed`. Where that build is reported depends on what serves the workstation:

- Behind a cloud Edge, the edge instance reports it in `proxy.version`.
- Behind an edge VM for hcs, vz or qemu, the edge VM reports it to the Ringleader daemon on your
  computer. The answer is the same for every workstation that edge VM serves.

A workstation on hcs, vz or qemu that its own network process serves has no Edge to set `records`
on. It records allowed connections only when its policy is `audit`, and only once its network
process runs the same build as the Ringleader daemon. After you update `rl`, the daemon restarts
the network process on the new build once per daemon run, where it can. That briefly interrupts the
workstation's network. Until then the workstation records nothing and does not list `allowed`.

A workstation that names a WorkstationConfig in `spec.configs` starts recording when that
WorkstationConfig's author turns on `audit`. The author reads the workstation's records only if
they own the workstation or are a namespace administrator.

## Requirements for an audit policy

Ringleader checks an `audit` policy when you apply the workstation:

- The workstation's provider must be GCP, AWS, Azure, hcs, vz or qemu. A new local workstation that
  names none runs on your computer's
  [Default local provider](https://docs.ringleader.dev/workstations/basics/#default-local-provider).
- On a cloud, the namespace must hold an Edge for that provider that is not being deleted. The
  check does not look at the region.
- An hcs, vz or qemu workstation needs no Edge.

Where Ringleader stores the workstation matters too:

- For a workstation that Ringleader stores, a cloud workstation or a
  [node-bound](https://docs.ringleader.dev/workstations/basics/#node-bound-workstations) local one, the
  apply needs no setting from whoever runs Ringleader.
- For a workstation stored only on your computer, a one-shot `rl` refuses `audit` until a daemon
  that supports it is running. Its message tells you to run `rl daemon start`. If that daemon
  cannot serve the workstation's own network process, the message gives one of three fixes. Run
  `rl daemon restart` if the daemon is older than your `rl`, update `rl` if the daemon is newer,
  or declare an Edge.

## Record what a workstation reaches

To turn a workstation's connections into a `strict` policy, record them with `audit` first.

1. Give the workstation an audit policy, in its own `egress` block or in a WorkstationConfig it
   uses:

   ```yaml
   spec:
     egress:
       enforcement: audit
   ```

   [Requirements for an audit policy](#requirements-for-an-audit-policy) says which providers
   need an Edge for it.
2. Wait until the workstation says it is recording. Its `status.egress.recorded` lists `allowed`
   once it is:

   ```bash
   rl workstation get my-box -o yaml
   ```

3. Use the workstation the way you normally do, for as long as it takes to cover its work. A
   destination it does not reach in that time is missing from the next step.
4. Wait 10 minutes, because Ringleader stores the connections every few minutes. Then list what
   the workstation reached, and write the `strict` policy those connections add up to:

   ```bash
   rl workstation egress my-box --allowed
   rl workstation egress my-box --suggest > egress.yaml
   ```

   `--suggest` refuses a
   [node-bound](https://docs.ringleader.dev/workstations/basics/#node-bound-workstations) workstation. Write its
   `strict` policy yourself from what `--allowed` lists, as
   [Lock down Claude Code for unattended runs](https://docs.ringleader.dev/guides/lock-down-claude-code/#allow-only-the-hosts-the-agent-used)
   shows.
5. Read `egress.yaml` and remove what the workstation should not reach. The policy keeps the
   destinations the workstation already declares. It adds each destination the workstation reached
   that they do not cover, with names and addresses copied as recorded. Hostnames on ports other
   than 80 and 443 are left out, and a note on standard error counts them. To reach one of those hosts,
   declare its address range as a `cidr`.
6. Apply `egress.yaml` as the workstation's `egress`, in place of `audit`.

[`rl workstation egress`](https://docs.ringleader.dev/reference/cli/commands/workstation-access/#rl-workstation-egress-workstation)
lists every flag.

## Next steps

- [Outbound restrictions](https://docs.ringleader.dev/security/outbound/outbound-restrictions/) shows how
  to apply the policy you wrote and how to keep a workstation off your local network.
- [Enforcement points](https://docs.ringleader.dev/security/outbound/enforcement/) says which providers
  hold an `audit` policy without an Edge.
- See [Edge management](https://docs.ringleader.dev/security/outbound/edge-management/) for declaring the Edge that records
  connections on a cloud.

