Add client-to-proxy authentication support#155
Open
rogerb-ds wants to merge 1 commit intodatastax:mainfrom
Open
Add client-to-proxy authentication support#155rogerb-ds wants to merge 1 commit intodatastax:mainfrom
rogerb-ds wants to merge 1 commit intodatastax:mainfrom
Conversation
Introduce optional CQL authentication between clients and the proxy so that clients must present credentials before traffic is forwarded to the backend. proxycore/proxyauth.go (new): - ProxyAuthenticator interface: MessageForStartup() and HandleAuthResponse() - noopProxyAuth: default, responds READY to STARTUP (no auth) - fakeProxyAuth: sends AUTHENTICATE then AUTH_SUCCESS for drivers that require the handshake (e.g. PasswordAuthenticator) but accepts any creds - passwordProxyAuth: real auth; validates credentials from CredentialStore - CredentialStore: in-memory username/password store with LoadFromEnv() for CQL_CREDENTIALS (format USERNAME=password,USER2=pass2), SHA-256 hashing proxy/proxy.go: - Config.ProxyAuth: optional ProxyAuthenticator - On STARTUP: send ProxyAuth.MessageForStartup() or Ready when nil - New case for AuthResponse: delegate to ProxyAuth.HandleAuthResponse(), send AuthSuccess or error; reject AuthResponse when ProxyAuth is nil - Fix missing return after sending compression error proxy/run.go: - runConfig: --fake-auth (FAKE_AUTH) and --client-auth (CLIENT_AUTH) - Wire ProxyAuth: noop by default; fake-auth => FakeProxyAuth; client-auth => PasswordProxyAuth with CredentialStore from CQL_CREDENTIALS - Log warning when client-auth is on but no credentials loaded Credits: Based on approach from datastax/cql-proxy branch handle-client-auth https://github.com/datastax/cql-proxy/tree/handle-client-auth Made-with: Cursor
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
Adds optional CQL authentication between clients and the proxy so that clients can be required to present credentials before traffic is forwarded to the backend.
Changes
proxycore/proxyauth.go (new)
proxy/proxy.go
proxy/run.go
Usage
Credits
Based on the approach from the handle-client-auth branch in this repository.