Repository navigation
vps: connect to servers behind a Cloudflare Tunnel (cloudflared) - #49
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test pins only for the stored endpoint, Access secret tied to its Client ID, empty host rejected after normalization, bounded WebSocket upgrade, userinfo stripped from tunnel host, pre-v4 row test, doc and locale polish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
x/net/websocket reports every refused upgrade as a bare ErrBadStatus, so an offline tunnel (Cloudflare 502/530) was told to add a service token. Perform the upgrade over a connection that records the start of the response and word the error by status class. Every refusal still wraps ErrTunnelRefused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Testing a saved host at a different address reused its stored password, key and Access secret with no pinned host key, so a dashboard session could point a saved host at any server and receive its credentials. Saved secrets and the pinned key are now used only while the form still points at the saved endpoint; otherwise only typed credentials are sent, nothing is pinned, and a blank password/key is refused with a clear message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
x/crypto/ssh reports a refused login as "ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain", which hides the usual cause: the form's username defaults to root while the server account is another user. Recognise that phrase and return ErrAuthFailed naming the user, the endpoint and whether the password or private key was used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The line sat 2px under the badge row, so the host's censor bar nearly touched the Online / cloudflared pills. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Servers that expose SSH only through a Cloudflare Tunnel (port 22 closed, reached with
ProxyCommand cloudflared access ssh --hostname %h) can now be added on the VPS page. A saved server gets a Connection setting: Direct SSH (unchanged) or Cloudflare Tunnel (cloudflared). In tunnel mode, Antares openswss://<hostname>/itself and runs SSH over binary WebSocket frames. This is the same carriercloudflared access sshuses, so the machine running Antares does not needcloudflaredinstalled. Every VPS feature works over it unchanged: Test, metrics, processes,vps_run, and upload/download.Hostnames protected by Cloudflare Access can use an optional service token (Client ID + Secret, sent as
Cf-Access-Client-Id/Cf-Access-Client-Secret). Interactive Access login is not supported, since a background agent cannot complete it.Design and plan:
docs/superpowers/specs/2026-11-14-vps-cloudflared-design.md,docs/superpowers/plans/2026-11-14-vps-cloudflared.md.Changes
tunnel,cf_client_idandcf_client_secrettovps_hosts. The secret is encrypted at rest like password/key. Existing rows default to direct SSH.internal/vps: newtunnel.go.dialTransporthandsdialeither a TCP conn or the WebSocket conn, so the SSH handshake, TOFU host-key pinning, keepalive, Run, SFTP and metrics run unchanged.https://, path anduser@are stripped;:portis kept).ErrAuthFailednaming the user, the endpoint and whether a password or private key was tried. x/crypto/ssh only reports this as text, so the common cause, a username left at therootdefault, is now visible.tunnel,cf_client_idandcf_client_secretare accepted. The view returnshas_cf_secretonly, never the secret. A blank secret on edit keeps the stored one, and the Access secret is dropped together with its Client ID./vps/testtests what the form shows. Stored credentials and the pinned host key are only used while the form still points at the saved address. Once the address changes, only typed credentials are sent and nothing is pinned. This prevents a dashboard session from redirecting a saved host's secrets to another server.user@hostline room below the status badges. Strings are added in en/id/ja/ru/zh.docs/tools.mdcovers tunnel hosts.No new dependencies (
golang.org/x/net/websocketwas already ingo.mod).Testing
go vet ./...andgo test ./...pass.Run/Pingover the tunnel transport, including host-key capture.ErrAuthFailednaming the user.TestLiveCloudflaredBanneris opt-in viaANTARES_LIVE_TUNNEL_HOST. It reads only the SSH banner through a real tunnel and sends no credentials. It passed against a real tunnel.web:bun run typecheck,bun testandbun run buildpass.GET /api/vps, the card tag, edit → Direct restoring Port 22, and the/api/vps/testaddress rule exercised withcurl.🤖 Generated with Claude Code