{"id":2058,"library":"gssapi","title":"Python GSSAPI Wrapper","description":"The `gssapi` library provides a Python wrapper for the Generic Security Service Application Programming Interface (GSSAPI), enabling applications to perform secure authentication and communication over various security mechanisms like Kerberos. As of version 1.11.1, it's actively maintained with frequent patch releases and minor updates every few months, often improving platform support and build processes.","status":"active","version":"1.11.1","language":"en","source_language":"en","source_url":"https://github.com/pythongssapi/python-gssapi","tags":["security","authentication","kerberos","gssapi","enterprise"],"install":[{"cmd":"pip install gssapi","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for Python's Foreign Function Interface to interact with the underlying C GSSAPI library.","package":"cffi","optional":false},{"reason":"Provides cryptographic primitives and secure communication utilities leveraged by the GSSAPI wrapper.","package":"cryptography","optional":false}],"imports":[{"symbol":"gssapi","correct":"import gssapi"},{"symbol":"Name","correct":"from gssapi import Name"},{"symbol":"SecurityContext","correct":"from gssapi import SecurityContext"},{"symbol":"KRB5_NT_PRINCIPAL_NAME","correct":"from gssapi.names import KRB5_NT_PRINCIPAL_NAME"}],"quickstart":{"code":"import gssapi\nfrom gssapi.names import KRB5_NT_PRINCIPAL_NAME, NT_HOSTBASED_SERVICE\n\n# GSSAPI operations heavily rely on an underlying C GSSAPI library\n# (e.g., Kerberos dev headers) being installed on the system.\n# This example will likely raise GSSError if not properly configured.\n\ntry:\n    # Example 1: Create a Kerberos principal name\n    user_principal = \"username@REALM.EXAMPLE.COM\"\n    name_user = gssapi.Name(user_principal, KRB5_NT_PRINCIPAL_NAME)\n    print(f\"Created user principal name: {name_user.display_name}\")\n\n    # Example 2: Create a host-based service name\n    service_principal = \"host/hostname.example.com@REALM.EXAMPLE.COM\"\n    name_service = gssapi.Name(service_principal, NT_HOSTBASED_SERVICE)\n    print(f\"Created service principal name: {name_service.display_name}\")\n\nexcept gssapi.exceptions.GSSError as e:\n    print(f\"WARNING: GSSAPI operation failed. \"\n          f\"Ensure a GSSAPI C library (e.g., Kerberos dev headers) is installed and configured on your system. Error: {e}\")\nexcept ImportError:\n    print(\"ERROR: 'gssapi' library not found. Please install it using 'pip install gssapi'.\")","lang":"python","description":"This quickstart demonstrates how to create GSSAPI Name objects, which are fundamental for identity representation. Note that `gssapi` requires a system-level GSSAPI C library to function correctly."},"warnings":[{"fix":"Install system-level GSSAPI development packages. Examples include `libkrb5-dev` (Debian/Ubuntu), `krb5-devel` (RHEL/CentOS), or `krb5` (Homebrew on macOS).","message":"The `gssapi` library is a Python wrapper for an underlying C GSSAPI library. This external C library (e.g., Kerberos development headers) must be installed on your system separately. `pip install gssapi` only installs the Python binding, not the core GSSAPI implementation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is version `3.9` or higher. Refer to the `requires_python` metadata on PyPI for specific version compatibility if targeting an older `gssapi` release.","message":"The minimum required Python version has increased over time. As of version `1.11.1`, Python `3.9+` is required. Older versions like `1.8.1` required `3.7+`.","severity":"breaking","affected_versions":"1.8.1+"},{"fix":"Avoid installing `gssapi==1.8.0` or `gssapi==1.11.0`. Use `gssapi==1.8.1` or `gssapi==1.11.1` (or newer) instead.","message":"Release `v1.8.0` was yanked from PyPI due to a critical bug related to its `requires_python` metadata. Release `v1.11.0` was also not properly pushed to PyPI due to a classifier bug and should be avoided.","severity":"breaking","affected_versions":"1.8.0, 1.11.0"},{"fix":"Ensure `Cython` is installed (`pip install Cython`) before attempting to install `gssapi` from source, or use environments where pre-built wheels are readily available.","message":"Building `gssapi` from source (e.g., if no pre-built wheels are available for your OS/Python version) requires `Cython` to be installed. While `pip` usually handles this for PEP 517 sdist, explicit pre-installation of `Cython` can prevent build failures in some environments.","severity":"gotcha","affected_versions":"All versions when building from source"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}