Skip to content

Add Kerberos Auth (#128) - #887

Open
pferate wants to merge 2 commits into
ClickHouse:mainfrom
pferate:128-kerberos-auth
Open

Add Kerberos Auth (#128)#887
pferate wants to merge 2 commits into
ClickHouse:mainfrom
pferate:128-kerberos-auth

Conversation

@pferate

@pferate pferate commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds a Kerberos connection options that generates a SPNEGO ("Negotiate") token from the Kerberos credential cache for each HTTP request.

Adds use_kerberos and kerberos_hostname_override parameters to both the sync (http) and async clients, backed by a new kerberos.py module built on pyspnego/gssapi/krb5 (new kerberos extra). Because ClickHouse authenticates each HTTP request independently rather than caching auth for a session, a fresh token is generated per request rather than once at connect time.

Issue: #128

Checklist

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG

pferate added 2 commits July 21, 2026 12:16
Adds use_kerberos and kerberos_hostname_override connection parameters
for both existing clients. Requires the new `kerberos` extra.
Stands up a real KDC and Kerberos-configured ClickHouse instance via
docker-compose (behind a `kerberos` profile) for end-to-end testing
of use_kerberos, plus a dedicated CI job.
@pferate
pferate force-pushed the 128-kerberos-auth branch from bf4412e to 4092a75 Compare July 21, 2026 19:32
@pferate
pferate marked this pull request as ready for review July 21, 2026 19:54
@joe-clickhouse

Copy link
Copy Markdown
Contributor

Hi @pferate thanks for this PR as well.

Before we commit to reviewing and maintaining this long term, could you share more about the environment driving it? Kerberos is excluded from ClickHouse Cloud, so this'll be a self-managed-only feature. Some of the other client maintainers are looking at the same question so your answers could help inform that broader decision. Specifically:

  1. Is this an Active Directory realm or MIT Kerberos, and what kind of environment is it?
  2. Is there an org actively running kerberized ClickHouse behind this? If so roughly at what scale?
  3. Is authenticating from the process credential cache sufficient for your case?
  4. Are your clients Linux only or do you also need Windows via SSPI?
  5. Is there a load balancer or proxy between clients and ClickHouse in your setup?

If you're more comfortable answering these outside of a public channel, let me know.

@pferate

pferate commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Hi @joe-clickhouse Personally, I don't have a dog in this race, so I can't give you any useful answers to those questions.

I was just looking through open issues and seeing where I can help contribute. I saw that #128 was open and stale, so I picked it.

@joe-clickhouse

Copy link
Copy Markdown
Contributor

@pferate understood! Thanks so much for the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants