Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2fc5e4e
docs: design BYON network join command
patelspratik Aug 7, 2026
2954f39
docs: design BYON network and SSH separation
patelspratik Aug 8, 2026
c666f75
docs: plan BYON network and SSH separation
patelspratik Aug 8, 2026
19a57b5
feat: require confirmed Brev tunnel connectivity
patelspratik Aug 10, 2026
e246665
fix: preserve Brev tunnel timeout cause
patelspratik Aug 10, 2026
4fb420d
feat: separate network join from SSH enablement
patelspratik Aug 10, 2026
06a7c16
test: strengthen join compatibility coverage
patelspratik Aug 10, 2026
1e903ed
feat: require joined tunnel before enabling SSH
patelspratik Aug 10, 2026
9225b49
test: prove enable-ssh reconnects before provisioning
patelspratik Aug 10, 2026
863f121
feat: add privileged node-wide Brev key cleanup
patelspratik Aug 10, 2026
745fa2b
fix: harden privileged key cleanup commit
patelspratik Aug 10, 2026
a0e4d2d
fix: verify privileged cleanup bytes
patelspratik Aug 10, 2026
6ddd467
feat: add node-wide disable-ssh command
patelspratik Aug 10, 2026
90dbd8b
feat: separate network leave from SSH cleanup
patelspratik Aug 10, 2026
c43e5f9
fix: preserve BYON command source compatibility
patelspratik Aug 10, 2026
f3aafe8
docs: explain explicit BYON network and SSH flows
patelspratik Aug 10, 2026
f15ffa3
fix: reject unavailable headless sudo preflight
patelspratik Aug 10, 2026
17659ee
test: satisfy BYON command lint boundaries
patelspratik Aug 10, 2026
d3cdc13
docs: revise disable-ssh cleanup contract
patelspratik Aug 11, 2026
d159155
docs: clarify disable-ssh failure contract
patelspratik Aug 11, 2026
a6afd91
docs: plan disable-ssh best-effort cleanup
patelspratik Aug 11, 2026
bca2d2d
refactor: simplify disable-ssh revocation
patelspratik Aug 14, 2026
5b6f8f0
simplifications
patelspratik Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .agents/skills/brev-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,34 @@ brev ls --json | jq -r '.workspaces[].name'
brev ls nodes --json | jq -r '.[] | select(.status=="Connected") | .name'
```

### BYON Network and SSH

For a machine you bring to Brev, network membership and SSH credentials are
separate operations:

```bash
# Join only the organization's Brev/NetBird network.
brev join

# Optionally enable access for yourself, then grant a collaborator.
brev enable-ssh
brev grant-ssh

# Explicitly revoke tracked SSH grants, then retire membership.
brev disable-ssh
brev leave
```

`brev register` and `brev deregister` are deprecated aliases for `join` and
`leave`; they warn when executed. `enable-ssh` requires an existing join and
can reconnect its tunnel, but never joins a network. Use `grant-ssh` and
`revoke-ssh` for individual collaborators. `disable-ssh` best-effort revokes
every backend-tracked SSH grant across the node, continuing after individual
failures and revoking the invoking Brev user's own access last. It does not
modify `authorized_keys`, close ports, stop `sshd`, end active sessions, or
leave the network. `leave` removes membership without running that per-grant
revocation flow or cleaning up local keys.

### Instance Management
```bash
# List instances
Expand Down
87 changes: 87 additions & 0 deletions .agents/skills/brev-cli/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,93 @@ Generate an invite link.
brev invite
```

## BYON Network and SSH Commands

These commands apply to a machine brought into a Brev organization. Network
membership and Brev-managed SSH credentials are separate.

### Canonical workflows

```bash
# Join networking only. Then optionally enable your SSH access and grant a collaborator.
brev join
brev enable-ssh
brev grant-ssh

# Explicitly revoke tracked SSH grants before retiring network membership.
brev disable-ssh
brev leave
```

### brev join / brev register

Join a device to the organization's Brev/NetBird network.

```bash
brev join [--name <device-name> --org <organization>] [--approve]
```

`join` establishes membership only: it does not enable SSH or allocate an SSH
port. `register` is a deprecated alias that warns on execution. The old
`--ssh-port` flag is no longer supported; migrate scripts to `brev join` and
then `brev enable-ssh` on the joined machine.

### brev enable-ssh

Enable Brev-managed SSH for the invoking Brev user on the joined node.

```bash
brev enable-ssh
```

This requires an existing `join`. It confirms the existing Brev tunnel and can
reconnect it when disconnected, but it does not add a node, select an
organization, save a registration, or join a network.

### brev grant-ssh / brev revoke-ssh

Manage an individual collaborator's SSH access tuple on a node.

```bash
brev grant-ssh
brev revoke-ssh
```

Use these commands for collaborator access rather than treating `enable-ssh`
or `disable-ssh` as collaborator-management commands.

### brev disable-ssh

Revoke all backend-tracked Brev SSH grants from the joined node.

```bash
brev disable-ssh [--approve]
```

This node-wide operation makes a best-effort attempt to revoke each exact active
backend access tuple. It continues after individual failures, reports an error
when any tuple remains, and revokes the invoking Brev user's own access last. It
does not inspect or modify local `authorized_keys` files. It leaves existing
ports allocated, leaves `sshd` running, does not forcibly terminate active SSH
sessions, and does not remove membership or the backend node.

### brev leave / brev deregister

Remove Brev network membership from the device.

```bash
brev leave [--approve]
```

`leave` removes the backend node, VPN route, and local registration. It does not
run `disable-ssh`'s per-grant revocation flow or modify local `authorized_keys`
files. Run `brev disable-ssh` first when explicit best-effort revocation of
tracked grants is desired. `deregister` is a deprecated alias that warns on
execution.

`leave` continues to uninstall NetBird even if it was installed before Brev.
Install-ownership tracking is a follow-up, so ensure that removal is intended.

## Configuration Commands

### brev login / brev logout
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ devworkspace/**
test.txt
test2.txt
homebrew-brev
flake-explorations
flake-explorations

# AI
/docs/superpowers/plans/
/docs/superpowers/specs/
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

[WIP] Add tailscale vpn client embedded with Brev.

- `brev join` for Brev/NetBird network membership, `brev leave` for membership teardown, and node-wide `brev disable-ssh`.

### Changed

- `brev join` no longer enables SSH. `brev enable-ssh` requires an existing joined membership and reconnects its tunnel when needed.
- `brev disable-ssh` best-effort revokes all backend-tracked SSH grants, revokes the invoking user's own access last, and no longer sweeps local `authorized_keys` files.

### Deprecated

- `brev register` and `brev deregister` remain compatibility aliases for `join` and `leave`, and warn on stderr when executed.

### Migration

- Scripts using `--ssh-port` must run `brev join` followed by `brev enable-ssh`.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ brev ls

https://docs.nvidia.com/brev/latest/

[Bring Your Own Node (BYON) network and SSH workflows](docs/BYON.md)

---

## AI Agent Integration
Expand Down
71 changes: 71 additions & 0 deletions docs/BYON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Bring Your Own Node (BYON)

Brev separates network membership from Brev-managed SSH credentials on a
machine you bring to your organization.

## Join networking only

```bash
brev join
```

`brev join` establishes this machine's Brev/NetBird organization membership.
It does not enable SSH or create an SSH port. Use `brev register` only for
compatibility with existing automation: it is a deprecated alias for `join` and
prints a warning when executed.

Scripts that used `--ssh-port` must migrate to two commands:

```bash
brev join
brev enable-ssh
```

## Enable and grant SSH

After joining, enable Brev-managed SSH for the invoking Brev user:

```bash
brev enable-ssh
```

`enable-ssh` requires a prior join. It confirms the existing Brev tunnel and
can reconnect it when it is disconnected; it never joins a network or creates
membership. It then enables the invoking user's access on the joined node.

Grant and revoke collaborator access separately:

```bash
brev grant-ssh
brev revoke-ssh
```

These commands manage individual collaborator access tuples. They are not part
of `join`, `enable-ssh`, or the node-wide revocation command.

## Retire Brev access and membership

To explicitly revoke Brev-tracked SSH grants before leaving the network:

```bash
brev disable-ssh
brev leave
```

`disable-ssh` is node-wide. It makes a best-effort attempt to revoke every
backend-tracked Brev SSH access tuple, continuing after individual failures and
revoking the invoking Brev user's own access last. It returns an error if any
revocation fails so the remaining records can be retried. It does not inspect or
modify local `authorized_keys` files. It leaves existing ports allocated, leaves
`sshd` running, does not forcibly terminate active SSH sessions, and does not
change network membership.

`leave` removes the backend node, Brev VPN route, and local registration. It
does not run the per-grant `disable-ssh` flow or modify local `authorized_keys`
files. Run `disable-ssh` first when explicit best-effort revocation of tracked
grants is desired. `brev deregister` is a deprecated alias for `leave` and warns
when executed.

`leave` preserves the existing behavior of uninstalling NetBird even when
NetBird was installed before Brev. Tracking whether Brev owns that installation
is a follow-up improvement, so use `leave` only when that removal is intended.
6 changes: 4 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/brevdev/brev-cli/pkg/cmd/copy"
"github.com/brevdev/brev-cli/pkg/cmd/delete"
"github.com/brevdev/brev-cli/pkg/cmd/deregister"
"github.com/brevdev/brev-cli/pkg/cmd/disablessh"
"github.com/brevdev/brev-cli/pkg/cmd/enablessh"
"github.com/brevdev/brev-cli/pkg/cmd/envvars"
"github.com/brevdev/brev-cli/pkg/cmd/exec"
Expand Down Expand Up @@ -316,10 +317,11 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
cmd.AddCommand(reset.NewCmdReset(t, loginCmdStore, noLoginCmdStore))
cmd.AddCommand(profile.NewCmdProfile(t, loginCmdStore, noLoginCmdStore))
cmd.AddCommand(refresh.NewCmdRefresh(t, loginCmdStore))
cmd.AddCommand(register.NewCmdRegister(t, externalNodeCmdStore))
cmd.AddCommand(deregister.NewCmdDeregister(t, externalNodeCmdStore))
cmd.AddCommand(register.NewCmdJoin(t, externalNodeCmdStore))
cmd.AddCommand(deregister.NewCmdLeave(t, externalNodeCmdStore))
cmd.AddCommand(upgrade.NewCmdUpgrade(t, noLoginCmdStore))
cmd.AddCommand(enablessh.NewCmdEnableSSH(t, externalNodeCmdStore))
cmd.AddCommand(disablessh.NewCmdDisableSSH(t, externalNodeCmdStore))
cmd.AddCommand(grantssh.NewCmdGrantSSH(t, externalNodeCmdStore))
cmd.AddCommand(revokessh.NewCmdRevokeSSH(t, externalNodeCmdStore))
cmd.AddCommand(runtasks.NewCmdRunTasks(t, noLoginCmdStore))
Expand Down
Loading
Loading