feat: HTTP/1.1 authentication before SSH tunnel#9
Open
coolaj86 wants to merge 1 commit into
Open
Conversation
2143eee to
bbd0fee
Compare
Add --http-auth and --auth-token flags to perform HTTP authentication over TLS (with http/1.1 ALPN) before establishing the SSH tunnel. Add --http-upgrade flag to use HTTP Upgrade header mechanism, allowing the proxy to hijack/switch the connection to SSH on the same TLS connection (similar to WebSocket upgrade but without websockets). Two modes: - Without --http-upgrade: Auth connection is closed after auth, then a second TLS+SSH connection is established (two connections) - With --http-upgrade <proto>: After auth, if proxy responds with 101 Switching Protocols + Upgrade: <proto>, the same connection is used for SSH (single connection, protocol switch) No changes to existing behavior when --http-auth is not used.
bbd0fee to
01501f4
Compare
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
--http-auth <url>flag to authenticate via HTTP/1.1 over TLS before establishing the SSH tunnel--auth-token <token>flag to send a Bearer token in the Authorization headertoken=xxx(e.g.,proxy.example.com/auth?token=mysecret)How it works
--http-authis set, each connection first establishes a TLS connection withhttp/1.1ALPNBearertoken (if provided)sshALPN for the actual SSH tunnelUsage examples
Files changed
sclient.go- AddedHttpAuthURL,AuthTokenfields to Tunnel struct; addedhttpAuth()method; updatedhandleConnection()and test connection logiccmd/sclient/main.go- Added--http-authand--auth-tokenCLI flags