Repository navigation
Conversation
On Windows, authenticate through pyspnego (SSPI, the logged on user's LSA Kerberos tickets) instead of requests-gssapi, so MIT Kerberos no longer has to be installed. The gssapi and requests_gssapi imports are now done only when SPNEGO is used, so importing phoenixdb no longer requires a GSSAPI library.
…ego on Windows A gssapi package installed without MIT Kerberos for Windows raises OSError on import. pyspnego only catches ImportError around that import, so "import spnego" failed with a misleading "Could not find KfW installation". Raise an error that names the cause and the fix instead.
Author
|
Could a committer please open a PHOENIX JIRA ticket for this (component: python)? I don't have an ASF JIRA account to file it myself. Suggested summary:
The PR description above can serve as the ticket description. Once the ticket exists, I'll retitle the PR and prefix the commits with the key. Thanks! |
Author
|
@stoty @richardantal could one of you file the PHOENIX JIRA for this, as asked above? Thanks. |
Author
|
cc @PDavid |
Contributor
|
Hi @AlonSoko, |
AlonSoko
force-pushed
the
windows-sspi-spnego
branch
from
October 26, 2026 16:10
562ed29 to
d65508a
Compare
Author
|
Thanks @PDavid! I've retitled the PR and prefixed the commits with PHOENIX-8033. |
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.
Problem
On Windows, phoenixdb requires MIT Kerberos for Windows (KfW), even though Windows has Kerberos built in (LSA/SSPI):
requests-gssapi(which pulls ingssapi) is an unconditional install requirement.phoenixdb/__init__.pyimportsgssapiandrequests_gssapiat module level, soimport phoenixdbfails without a working GSSAPI library, even for BASIC/DIGEST/no authentication.Changes
phoenixdb/__init__.py: thegssapi/requests_gssapiimports move into_get_SPNEGOAuth(), which only runs forauthentication='SPNEGO'. Onwin32it returns the new SSPI auth class; elsewhere (or ifpyspnegois not available) it buildsHTTPSPNEGOAuth(opportunistic_auth=True, mech=SPNEGO)exactly as before.phoenixdb/sspi_auth.py(new):HTTPSPNEGOAuthSSPI, a smallrequestsauth class on top of pyspnego, which uses native SSPI on Windows and so the logged-on user's tickets (no KfW, nokinit). It mirrors the current behaviour: an opportunisticNegotiatetoken forHTTP/<host>, mutual auth disabled. A 401 carrying a server token is answered once on the same connection (multi-leg, e.g. NTLM fallback); a 401 without one is returned as is.protocol="negotiate"(the SPNEGO mechanism), keeping the mechanism choice from PHOENIX-6414 / PHOENIX-6781.requests-kerberoswas not used because it hard-codes the raw Kerberos mechanism.gssapipackage installed without KfW raisesOSErroron import, and pyspnego only catchesImportErroraround its optional gssapi import (reported as import spnego fails on Windows when python-gssapi is installed without MIT KfW (OSError not caught) jborean93/pyspnego#117), soimport spnegofails. That case now raises aRuntimeErrornaming the cause and the fix (pip uninstall gssapi requests-gssapi).setup.py,requirements.txt: platform markers;requests-gssapion non-Windows,pyspnegoon Windows (Python >= 3.8). Python < 3.8 is unchanged.Linux/macOS behaviour and the public API (
connect(..., authentication='SPNEGO'),userasdoAs) are unchanged.Testing
kinit), Python 3.12 x64, against a Kerberized Phoenix Query Server:SELECT 1and table queries succeed withauthentication='SPNEGO';klistshows theHTTP/<fqdn>service ticket obtained through SSPI.spnego.server), NTLM fallback: 401 + challenge, then 200 on the same connection; a 401 without a token is returned after a single request.import phoenixdbworks withoutgssapiinstalled; the existing unit tests that do not need a live Query Server pass.JIRA: https://issues.apache.org/jira/browse/PHOENIX-8033