feat: Use Port IDs on Grant, Revoke SSH#397
Conversation
| t.Vprint("") | ||
|
|
||
| // Check if the node already has an SSH port allocated (e.g. for another linux user) | ||
| port, err := existingSSHPort(ctx, deps, tokenProvider, reg) |
There was a problem hiding this comment.
This is not a thing anymore. We now need to ask either: do you want to open a port, or do you want to use an existing port?
| t.Vprintf(" %s\n", t.Yellow(fmt.Sprintf("Warning: could not check for existing ports: %v", err))) | ||
| return fmt.Errorf("enable SSH failed: %w", err) |
There was a problem hiding this comment.
Some of these errors just ¯\(ツ)/¯ 'd before, so tightening them to immediately fail.
| if p.GetProtocol() == nodev1.PortProtocol_PORT_PROTOCOL_SSH { | ||
| return p.GetPortNumber(), nil | ||
| } |
There was a problem hiding this comment.
Core to this PR: this will now always return false, so there is no point in doing any of this checking for the SSH protocol.
| return fmt.Errorf("invalid SSH port %d: port must be between 1 and 65535", port) | ||
| return "", fmt.Errorf("invalid port %d: port must be between 1 and 65535", port) |
There was a problem hiding this comment.
Calling it "SSH" here (and elsewhere) isn't exactly wrong, but making consistent with the rest of the system.
| taggedKey := pubKey + " " + BrevKeyTag(brevUserID) | ||
| taggedLine := pubKey + " " + DevplaneAuthorizedKeysComment(portID, brevUserID) |
There was a problem hiding this comment.
Honor the devplane comment/tag here. Today we can leave keys dangling in authorized_keys.
| buf.build/gen/go/brevdev/devplane/connectrpc/go v1.19.2-20260520183101-9f4cb67aff2c.1 | ||
| buf.build/gen/go/brevdev/devplane/protocolbuffers/go v1.36.11-20260520183101-9f4cb67aff2c.1 |
There was a problem hiding this comment.
Will update once https://github.com/brevdev/dev-plane/pull/2182 is merged.
| @@ -346,11 +346,11 @@ develop-with-nix: | |||
| nix develop . | |||
|
|
|||
| .PHONY: update-devplane-deps | |||
There was a problem hiding this comment.
This was failing to find the appropriate connect modules before.
Companion to https://github.com/brevdev/dev-plane/pull/2182
Port IDs must be explicitly used and persisted going forward, as SSH-type ports are simply TCP.