feat(register): add brev-managed sshd on port 2222#305
Open
Conversation
Add a hardened sshd instance managed by brev register/deregister that runs on port 2222 alongside the system sshd. Uses public key auth only, modern ciphers/KEX/MACs, isolated host keys in /etc/brev-sshd/, and a systemd unit for process supervision. - Add ManagedSSHDaemon interface + BrevSSHD provider - Wire sshd install as Step 2 in registration flow - Add non-fatal sshd cleanup to deregistration flow - Add config/unit content tests and mock-based integration tests
- Wire AddAllowedUser/RemoveAllowedUser into GrantSSHAccessToNode with rollback on RPC failure - Add ReloadBrevSSHD to pick up config changes without dropping connections - Add brev-sshd to enablessh checkSSHDaemon service list - Split systemctl commands for better error messages and pipe stderr - Remove unused brevSSHDBinary const - Add tests for AllowUsers add/remove/idempotent/cleanup
…e-ssh The managed sshd on port 2222 is only needed when SSH access is granted, not at registration time. This moves the install step into enable-ssh so it runs right before granting access.
When brev-sshd is not yet running, tell the user what will be installed before proceeding. Skip the message on subsequent enable-ssh calls.
Tell the user what enabling SSH will do before they accept the prompt. Install the managed sshd before granting access so AllowUsers and the config exist when GrantSSHAccessToNode runs.
patelspratik
reviewed
Mar 5, 2026
| LoginGraceTime 30 | ||
|
|
||
| # Reuse the same authorized_keys managed by sshkeys.go — no separate key store needed. | ||
| AuthorizedKeysFile %h/.ssh/authorized_keys |
Contributor
There was a problem hiding this comment.
if we are sandboxing an entire ssh, we should use our own authorized_keys file in /etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/etc/brev-sshd/, systemd unit for process supervisionTest plan
go build ./...compiles cleanlygo test ./pkg/cmd/register/... ./pkg/cmd/deregister/...all passbrev registercreates/etc/brev-sshd/sshd_config, startsbrev-sshd.service,ss -tlnp | grep 2222shows listeningssh -p 2222 user@localhostworks with key auth, password auth rejectedbrev deregisterstops service and removes all brev-sshd artifacts