# Set up one Edge for two teams

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


> Give two teams in one namespace their own outbound allowlists, and add a shared GitHub token to the platform team's requests, with one Edge.


Give two teams in one namespace their own outbound allowlists, and add a shared GitHub token to
the platform team's requests, with one Edge. Use this when teams share a namespace on Google Cloud
and each should reach only its own hosts. In the example, the platform team calls the GitHub API
and the data team installs Python packages. Each team reaches only its own hosts, and the token
is never on a workstation.

## Prerequisites

- [Ringleader installed](https://docs.ringleader.dev/install/), with the Ringleader application
  running.
- A Google Cloud project that you set up by following
  [Onboard Google Cloud](https://docs.ringleader.dev/guides/onboard-gcp/), and a
  [CloudIdentity](https://docs.ringleader.dev/reference/resources/cloudidentity/) in the namespace `acme` that places
  workstations in a `us-east4` zone. The examples use the namespace `acme`; replace it with
  yours.
- Permission to declare an Edge in that namespace. A namespace administrator applies the Edge,
  the Integration, the WorkstationConfigs and the Policy, and each team member applies their
  own workstations.
- A GitHub personal access token for the platform team.
- Two workstations, which you create in
  [Create a workstation for each team](#create-a-workstation-for-each-team). The examples name
  them `platform-01` and `data-01`; replace them with yours.

## Declare the Edge

As a namespace administrator, declare one Edge for the region. On AWS and Azure the Edge also
names a subnet, as [Declare an Edge](https://docs.ringleader.dev/security/outbound/edge-management/#declare-an-edge)
shows.

1. Save this as `edge.yaml`:

   ```yaml
   apiVersion: core.ringleader.dev/v1
   kind: Edge
   metadata:
     name: gcp-us-east4
     namespace: acme
   spec:
     provider: gcp
     region: us-east4
   ```

2. Run `rl apply -f edge.yaml`. Ringleader builds the Edge's VM when the first workstation that
   needs it reports in.

## Add the token for the platform team

Store the token in a Secret, then apply an Integration that adds it to the platform team's
requests to the GitHub API.

1. Store the token in a Secret named `github-pat`:

   ```bash
   rl secret create github-pat -n acme --from-string token=<your-token>
   ```

2. Save this as `integration.yaml`:

   ```yaml
   apiVersion: workstations.ringleader.dev/v1
   kind: Integration
   metadata:
     name: github-api
     namespace: acme
   spec:
     type: httpProxy
     selector:
       matchLabels:
         team: platform
     httpProxy:
       rules:
         - host: api.github.com
           inject:
             header: Authorization
             value: "Bearer ${secret:github-pat/token}"
   ```

3. Run `rl apply -f integration.yaml`. The Edge now sets the `Authorization` header on every
   request that a `team: platform` workstation sends to `api.github.com`. Tools on the
   workstation call the API as if they had signed in, and the token is not on the workstation.

## Limit what each team can reach

Apply one WorkstationConfig for each team. Each selects its team's workstations by label and
carries an egress policy (see [outbound restrictions](https://docs.ringleader.dev/security/outbound/outbound-restrictions/)).

1. Save this as `egress.yaml`:

   ```yaml
   apiVersion: workstations.ringleader.dev/v1
   kind: WorkstationConfig
   metadata:
     name: platform-egress
     namespace: acme
   spec:
     selector:
       matchLabels:
         team: platform
     egress:
       enforcement: strict
       destinations:
         - host: github.com
         - host: "*.githubusercontent.com"
   ---
   apiVersion: workstations.ringleader.dev/v1
   kind: WorkstationConfig
   metadata:
     name: data-egress
     namespace: acme
   spec:
     selector:
       matchLabels:
         team: data
     egress:
       enforcement: strict
       destinations:
         - host: pypi.org
         - host: files.pythonhosted.org
   ```

2. Run `rl apply -f egress.yaml`.

The platform team's configuration does not list `api.github.com`, because Ringleader adds a host
that an Integration injects a key for, on ports 80 and 443. A `host` destination can use only
those two ports, so the platform team clones from GitHub over HTTPS, not SSH.
[Destinations Ringleader adds](https://docs.ringleader.dev/security/outbound/outbound-restrictions/#destinations-ringleader-adds)
says which others it adds.

## Limit what members can name

Without a Policy, a member can widen their own workstation's allowlist with a layer of their
own. Apply a Policy that sets the destinations anyone in the namespace may name.

1. Save this as `policy.yaml`:

   ```yaml
   apiVersion: core.ringleader.dev/v1
   kind: Policy
   metadata:
     name: egress-limit
     namespace: acme
   spec:
     priority: 50
     rules:
       egressDestinations:
         default: deny
         allow:
           - github.com
           - "*.githubusercontent.com"
           - api.github.com
           - pypi.org
           - files.pythonhosted.org
   ```

2. Run `rl apply -f policy.yaml`. A Workstation, WorkstationConfig or Integration that names any
   other destination is now refused when it is applied.

The list includes `api.github.com` because the Policy also judges the hosts an Integration names.
[Egress destination entries](https://docs.ringleader.dev/reference/resources/policy/#egress-destination-entries) says
how entries are matched.

## Create a workstation for each team

Each team member applies their own workstation with their team's label. The file names the provider
of the Edge, because a workstation that names none runs on the team member's own computer.

1. Save this as `platform-01.yaml`:

   ```yaml
   apiVersion: workstations.ringleader.dev/v1
   kind: Workstation
   metadata:
     name: platform-01
     namespace: acme
     labels:
       team: platform
   spec:
     provider: gcp
   ```

2. Run `rl apply -f platform-01.yaml`.
3. For a data team workstation, save the same file as `data-01.yaml` with the name `data-01` and
   the label `team: data`, and run `rl apply -f data-01.yaml`.

<div class="callout callout-warning">
  <p class="callout-title">Labels are set by the workstation&rsquo;s owner</p>
  <div class="callout-body">
    A member can add <code>team: platform</code> to their own workstation to get the token, or remove
<code>team: data</code> to drop the data team&rsquo;s allowlist. To keep a token or a host away from some people,
give the people who need it a namespace of their own. <a href="https://docs.ringleader.dev/security/outbound/edge-management/#labels-and-namespaces">Labels and namespaces</a> says why.
  </div>
</div>


## Check that each team reaches only its own hosts

Until the Edge serves a workstation, the workstation is held closed, and its `EgressEnforced`
condition reads `False` and says why.

1. Run `rl edge get gcp-us-east4 -n acme`. Once the Edge serves the workstations, `Ready` reads
   `True` with reason `Serving`.
2. Run `rl workstation describe platform-01 -n acme`. `EgressEnforced` reads `True` with reason
   `Enforced`.
3. From a shell on each workstation, run the requests in the table below.

| Request | `team: platform` | `team: data` |
|---|---|---|
| `curl https://github.com` | Works | Connection reset |
| `curl https://api.github.com/user` | Returns the token owner's GitHub user | Connection reset |
| `curl https://pypi.org/simple/requests/` | Connection reset | Works |
| `curl https://example.com` | Connection reset | Connection reset |

Both workstations also reach what they need to stay managed by Ringleader, which you never list.
The Edge and your cloud's firewall are outside the workstation. Nothing running on it, including
an AI coding agent running as root, can undo the restriction.

## Troubleshoot

- If `rl edge get` shows `Ready` `False` with reason `NoMachine`, no workstation that needs the
  Edge has reported in yet. Apply a workstation, and the Edge builds its VM.
- If `rl apply` refuses a workstation with `forbidden: spec.egress.destinations[0].host names
  "pastebin.com"`, the Policy does not permit that destination. Remove it, or ask an
  administrator to add it to the Policy.
- If a request from a workstation fails with a connection reset, the host is not on its team's
  allowlist. [Denied connections](https://docs.ringleader.dev/security/outbound/filtering/#denied-connections)
  explains the reset.

## Next steps

- [Edge management](https://docs.ringleader.dev/security/outbound/edge-management/) explains what an Edge does, what it costs,
  and how to delete one.
- [Injected credentials](https://docs.ringleader.dev/security/credentials/injected-credentials/) covers local
  workstations, MCP servers and rotating the token.
- [Outbound restrictions](https://docs.ringleader.dev/security/outbound/outbound-restrictions/) shows
  the egress policy in full.
- [Edge](https://docs.ringleader.dev/reference/resources/edge/) lists the spec, the status and the conditions of an
  Edge.

