krb5


Namekrb5 JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/jborean93/pykrb5
SummaryKerberos API bindings for Python
upload_time2023-08-29 00:04:39
maintainer
docs_urlNone
authorJordan Borean
requires_python>=3.7
licenseMIT
keywords krb5 kerberos
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Kerberos 5 Library

[![Test workflow](https://github.com/jborean93/pykrb5/actions/workflows/ci.yml/badge.svg)](https://github.com/jborean93/pykrb5/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/krb5.svg)](https://badge.fury.io/py/krb5)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jborean93/pykrb5/blob/main/LICENSE)

This library provides Python functions that wraps the Kerberos 5 C API.
Due to the complex nature of this API it is highly recommended to use something like [python-gssapi](https://github.com/pythongssapi/python-gssapi) which exposes the Kerberos authentication details through GSSAPI.

## Requirements

* An implementation of the Kerberos 5 API - including the header files
  * [MIT Kebreros](https://web.mit.edu/kerberos/)
  * [Heimdal](https://github.com/heimdal/heimdal)
* A C compiler, such as GCC
* Python 3.6+

_Note: macOS includes their own implementation of Heimdal and a compiler isn't needed on that platform if installing from the wheel._

## Installation

Simply run:

```bash
pip install krb5
```

To install from source run the following:

```bash
git clone https://github.com/jborean93/pykrb5.git
python -m pip install build
python -m build
pip install dist/krb5-*.whl
```

Compiling the code should automatically pick up the proper paths for the KRB5 headers and locations.
If further customisation is needed, the following environment variables can be set when building the wheel:

* `KRB5_KRB5CONFIG`
  * The path to `krb5-config` to use for detecting the Kerberos library to link to
  * The compiler and linker args are derived from what this function outputs
  * Defaults to whatever `krb5-config` is on the `PATH`
  * FreeBSD will default to `/usr/local/bin/krb5-config` instead of `/usr/bin/krb5-config`
* `KRB5_MAIN_LIB`
  * The path to the `libkrb5` shared library used to check if any of the optional functions are available
* `KRB5_COMPILER_ARGS`
  * Compiler flags to use when compiling the extensions
  * Defaults to the output of `krb5-config --cflags krb5` if not set
* `KRB5_LINKER_ARGS`
  * Linker flags to use when compiling the extensions
  * Defaults to the output of `krb5-config --libs krb5` if not set
* `KRB5_SKIP_MODULE_CHECK`
  * Skips the checks used to detect if optional functions are available - will treat them all as available
  * This is only really useful when building the sdist as no implementation provides all these functions
* `KRB5_CYTHON_TRACING`
  * Used to generate the Cython extensions with line tracing for coverage collection
* `KRB5_MACOS_HEIMDAL_DIR`
  * Used when compiling on macOS to point to the Heimdal install directory
  * Used to find the Heimdal header files as macOS does not include, or provide a way to obtain, these header files for their Heimdal framework
  * Defaults to `{git_root}/build_helpers/heimdal`

## Development

To run the tests or make changes to this repo run the following:

```bash
git clone https://github.com/jborean93/pykrb5.git
pip install -r requirements-dev.txt
pre-commit install

python -m pip install -e .

# Can compile the krb5 extensions on an adhoc basis
# python setup.py build_ext --inplace
```

From there an editor like VSCode can be used to make changes and run the test suite.
To recompile the Cython files after a change run the `build_ext --inplace` command.

## Structure

This library is merely a wrapper around the Kerberos 5 APIs.
The functions under the `krb5` namespace match the KRB5 API specification but with the `krb5_` prefix remove.
For example the [krb5_init_context](https://web.mit.edu/kerberos/krb5-devel/doc/appdev/refs/api/krb5_init_context.html) function is called through `krb5.init_context()`.
Errors are raised as a `Krb5Error` which contains the message as formatted by the KRB5 implementation and the error code for that error.
Some of the structures returned by these functions are represented by a Python class and are freed once they are deallocated once all references to that object is removed.
Some classes expose an `addr` property that returns the raw pointer address of the structure it is wrapping.
This is so the structure can be used in other libraries like `python-gssapi` but great care must be taken that nothing else frees the structure as that could cause a segmentation fault.

Not all the functions exposed in this library are available on every KRB5 API implementation.
To check if a function is available run the following:

```python
import krb5

if not hasattr(krb5, "kt_dup"):
    raise Exception("Current implementation does not support krb5_kt_dup")
```

There may also be some difference in behaviour, error codes, error messages, between te different implementations.
It is up to the caller to paper over these differences when required.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jborean93/pykrb5",
    "name": "krb5",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "krb5,kerberos",
    "author": "Jordan Borean",
    "author_email": "jborean93@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/22/dc/68f9676de8405c48b68b47dfcc2a81ec865a1c3d63674ec8a36e2bcf6f57/krb5-0.5.1.tar.gz",
    "platform": null,
    "description": "# Python Kerberos 5 Library\n\n[![Test workflow](https://github.com/jborean93/pykrb5/actions/workflows/ci.yml/badge.svg)](https://github.com/jborean93/pykrb5/actions/workflows/ci.yml)\n[![PyPI version](https://badge.fury.io/py/krb5.svg)](https://badge.fury.io/py/krb5)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jborean93/pykrb5/blob/main/LICENSE)\n\nThis library provides Python functions that wraps the Kerberos 5 C API.\nDue to the complex nature of this API it is highly recommended to use something like [python-gssapi](https://github.com/pythongssapi/python-gssapi) which exposes the Kerberos authentication details through GSSAPI.\n\n## Requirements\n\n* An implementation of the Kerberos 5 API - including the header files\n  * [MIT Kebreros](https://web.mit.edu/kerberos/)\n  * [Heimdal](https://github.com/heimdal/heimdal)\n* A C compiler, such as GCC\n* Python 3.6+\n\n_Note: macOS includes their own implementation of Heimdal and a compiler isn't needed on that platform if installing from the wheel._\n\n## Installation\n\nSimply run:\n\n```bash\npip install krb5\n```\n\nTo install from source run the following:\n\n```bash\ngit clone https://github.com/jborean93/pykrb5.git\npython -m pip install build\npython -m build\npip install dist/krb5-*.whl\n```\n\nCompiling the code should automatically pick up the proper paths for the KRB5 headers and locations.\nIf further customisation is needed, the following environment variables can be set when building the wheel:\n\n* `KRB5_KRB5CONFIG`\n  * The path to `krb5-config` to use for detecting the Kerberos library to link to\n  * The compiler and linker args are derived from what this function outputs\n  * Defaults to whatever `krb5-config` is on the `PATH`\n  * FreeBSD will default to `/usr/local/bin/krb5-config` instead of `/usr/bin/krb5-config`\n* `KRB5_MAIN_LIB`\n  * The path to the `libkrb5` shared library used to check if any of the optional functions are available\n* `KRB5_COMPILER_ARGS`\n  * Compiler flags to use when compiling the extensions\n  * Defaults to the output of `krb5-config --cflags krb5` if not set\n* `KRB5_LINKER_ARGS`\n  * Linker flags to use when compiling the extensions\n  * Defaults to the output of `krb5-config --libs krb5` if not set\n* `KRB5_SKIP_MODULE_CHECK`\n  * Skips the checks used to detect if optional functions are available - will treat them all as available\n  * This is only really useful when building the sdist as no implementation provides all these functions\n* `KRB5_CYTHON_TRACING`\n  * Used to generate the Cython extensions with line tracing for coverage collection\n* `KRB5_MACOS_HEIMDAL_DIR`\n  * Used when compiling on macOS to point to the Heimdal install directory\n  * Used to find the Heimdal header files as macOS does not include, or provide a way to obtain, these header files for their Heimdal framework\n  * Defaults to `{git_root}/build_helpers/heimdal`\n\n## Development\n\nTo run the tests or make changes to this repo run the following:\n\n```bash\ngit clone https://github.com/jborean93/pykrb5.git\npip install -r requirements-dev.txt\npre-commit install\n\npython -m pip install -e .\n\n# Can compile the krb5 extensions on an adhoc basis\n# python setup.py build_ext --inplace\n```\n\nFrom there an editor like VSCode can be used to make changes and run the test suite.\nTo recompile the Cython files after a change run the `build_ext --inplace` command.\n\n## Structure\n\nThis library is merely a wrapper around the Kerberos 5 APIs.\nThe functions under the `krb5` namespace match the KRB5 API specification but with the `krb5_` prefix remove.\nFor example the [krb5_init_context](https://web.mit.edu/kerberos/krb5-devel/doc/appdev/refs/api/krb5_init_context.html) function is called through `krb5.init_context()`.\nErrors are raised as a `Krb5Error` which contains the message as formatted by the KRB5 implementation and the error code for that error.\nSome of the structures returned by these functions are represented by a Python class and are freed once they are deallocated once all references to that object is removed.\nSome classes expose an `addr` property that returns the raw pointer address of the structure it is wrapping.\nThis is so the structure can be used in other libraries like `python-gssapi` but great care must be taken that nothing else frees the structure as that could cause a segmentation fault.\n\nNot all the functions exposed in this library are available on every KRB5 API implementation.\nTo check if a function is available run the following:\n\n```python\nimport krb5\n\nif not hasattr(krb5, \"kt_dup\"):\n    raise Exception(\"Current implementation does not support krb5_kt_dup\")\n```\n\nThere may also be some difference in behaviour, error codes, error messages, between te different implementations.\nIt is up to the caller to paper over these differences when required.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Kerberos API bindings for Python",
    "version": "0.5.1",
    "project_urls": {
        "Homepage": "https://github.com/jborean93/pykrb5"
    },
    "split_keywords": [
        "krb5",
        "kerberos"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c9e10f1c7d6404894db1472424c684eaa3abbbc9e9c81a48171beead3808f7b",
                "md5": "a839d6aad6f6e966d0096172c161007d",
                "sha256": "e51c700cf148e63fef60bc4b2c453018218a3170dedbfe2840f122aee5a453e7"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a839d6aad6f6e966d0096172c161007d",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 958268,
            "upload_time": "2023-08-29T00:04:19",
            "upload_time_iso_8601": "2023-08-29T00:04:19.132969Z",
            "url": "https://files.pythonhosted.org/packages/6c/9e/10f1c7d6404894db1472424c684eaa3abbbc9e9c81a48171beead3808f7b/krb5-0.5.1-cp310-cp310-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "565eb73fdc7a2275bdbb739935e74a175668a6e6ef2deee2f9e37ec4cbdf57fa",
                "md5": "ecc3a08b61c43a51f5cbacf3f8a94682",
                "sha256": "6ca9dcb23dc0014f79af0f151bb501bfe4f371b3e54bde78e79ea73dad272eda"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp310-cp310-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "ecc3a08b61c43a51f5cbacf3f8a94682",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 905081,
            "upload_time": "2023-08-29T00:04:21",
            "upload_time_iso_8601": "2023-08-29T00:04:21.316053Z",
            "url": "https://files.pythonhosted.org/packages/56/5e/b73fdc7a2275bdbb739935e74a175668a6e6ef2deee2f9e37ec4cbdf57fa/krb5-0.5.1-cp310-cp310-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1439974a6898c0447bcb0ff742d8f660507235928708b33acc467a075d27296",
                "md5": "435d08a5da9a10e696c3e074e9328709",
                "sha256": "83d0a7d44130681f6a8168fc3609d783c77868fe1ab4a9861da30ae8212d632a"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "435d08a5da9a10e696c3e074e9328709",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 960909,
            "upload_time": "2023-08-29T00:04:23",
            "upload_time_iso_8601": "2023-08-29T00:04:23.330212Z",
            "url": "https://files.pythonhosted.org/packages/c1/43/9974a6898c0447bcb0ff742d8f660507235928708b33acc467a075d27296/krb5-0.5.1-cp311-cp311-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "139b1cdca966e543624a44c77e106c6d4bdf0e9a0f46694f8f5ce092742a31c9",
                "md5": "82e1ac0f6c9932c5b2ac14eefdeee3e2",
                "sha256": "2269fb6c0813cd7f58526a152d746aebb8e48026b92856093865414395c185e9"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp311-cp311-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "82e1ac0f6c9932c5b2ac14eefdeee3e2",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 907518,
            "upload_time": "2023-08-29T00:04:25",
            "upload_time_iso_8601": "2023-08-29T00:04:25.336409Z",
            "url": "https://files.pythonhosted.org/packages/13/9b/1cdca966e543624a44c77e106c6d4bdf0e9a0f46694f8f5ce092742a31c9/krb5-0.5.1-cp311-cp311-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "858279c5dc2c81fb881ee8bc408a55fa95a6c732eb54fc71091238ef64d440d7",
                "md5": "a123c97a0b45a327f6891934cf2893c7",
                "sha256": "f65fbbcf6de0fecee56a05370b6f65230c121a0cadad8e6a56f5a852bdeecaa6"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a123c97a0b45a327f6891934cf2893c7",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 974287,
            "upload_time": "2023-08-29T00:04:27",
            "upload_time_iso_8601": "2023-08-29T00:04:27.412446Z",
            "url": "https://files.pythonhosted.org/packages/85/82/79c5dc2c81fb881ee8bc408a55fa95a6c732eb54fc71091238ef64d440d7/krb5-0.5.1-cp312-cp312-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3ee78ee3705300b368fa381399f97703efc3d1d137560bda07b384fd93ce7a7",
                "md5": "f42a4c7831e7798e301683453e9d99b2",
                "sha256": "e0412d84484bf37158f040baa86ac3c08604251f9d0afdf2e9659b237ce3cdfa"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp312-cp312-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "f42a4c7831e7798e301683453e9d99b2",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 918179,
            "upload_time": "2023-08-29T00:04:28",
            "upload_time_iso_8601": "2023-08-29T00:04:28.939950Z",
            "url": "https://files.pythonhosted.org/packages/d3/ee/78ee3705300b368fa381399f97703efc3d1d137560bda07b384fd93ce7a7/krb5-0.5.1-cp312-cp312-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a089b0eaf0b72b0e3c9a8c9c9ca471660e107a851f02ec613cd63d3e9169527",
                "md5": "a41d88766a16805c3d659b3c75d006db",
                "sha256": "fb69fe96be7197f007b5b20172346728349d0b03a39b3343e8793fabb3d28626"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a41d88766a16805c3d659b3c75d006db",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 959888,
            "upload_time": "2023-08-29T00:04:30",
            "upload_time_iso_8601": "2023-08-29T00:04:30.603344Z",
            "url": "https://files.pythonhosted.org/packages/4a/08/9b0eaf0b72b0e3c9a8c9c9ca471660e107a851f02ec613cd63d3e9169527/krb5-0.5.1-cp37-cp37m-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "657a853a63f87339c6956715bbb452923140542aed450186a6876668399256dc",
                "md5": "4d6fe65c2a57b42d3562fbe3c0f3fb0a",
                "sha256": "73badd6982e8af81e4cca82c4f1a6dbcc50257d700072b8df7c84ea003c1b5e4"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4d6fe65c2a57b42d3562fbe3c0f3fb0a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 964197,
            "upload_time": "2023-08-29T00:04:32",
            "upload_time_iso_8601": "2023-08-29T00:04:32.459262Z",
            "url": "https://files.pythonhosted.org/packages/65/7a/853a63f87339c6956715bbb452923140542aed450186a6876668399256dc/krb5-0.5.1-cp38-cp38-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd912877664b7913ec3c87b9a98d02e15704c6177b200450b27de3eab34e7eea",
                "md5": "d2281bc392ee37aeaf8fd92a42217a0b",
                "sha256": "a9b4109adf9f02d0885c96611aba1945970b5319a93cb427617049d6536921ac"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp38-cp38-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "d2281bc392ee37aeaf8fd92a42217a0b",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 912031,
            "upload_time": "2023-08-29T00:04:34",
            "upload_time_iso_8601": "2023-08-29T00:04:34.152465Z",
            "url": "https://files.pythonhosted.org/packages/fd/91/2877664b7913ec3c87b9a98d02e15704c6177b200450b27de3eab34e7eea/krb5-0.5.1-cp38-cp38-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8870ed90b1f206022ff11e7c14b4d1cbdc1ab421fa62aec54c0b1a113bf30ef3",
                "md5": "b412bd8b78e886472e8fcf06fcc0da53",
                "sha256": "df15e3fe8b1d03cf715b5866215da6b131e1fd5ddd6e7f659e74bb79498033b2"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp39-cp39-macosx_10_9_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b412bd8b78e886472e8fcf06fcc0da53",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 963354,
            "upload_time": "2023-08-29T00:04:35",
            "upload_time_iso_8601": "2023-08-29T00:04:35.558482Z",
            "url": "https://files.pythonhosted.org/packages/88/70/ed90b1f206022ff11e7c14b4d1cbdc1ab421fa62aec54c0b1a113bf30ef3/krb5-0.5.1-cp39-cp39-macosx_10_9_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bca2192652b62b40b1f8853643369ff00a8ed305b18968ed33c8bc0dd710031",
                "md5": "cdfb4a01f3356928d845639d4afbe0ab",
                "sha256": "3008124d01da50559ee7ac2ce0045ee069963f3086ec5c2460b07da6fae4fdda"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1-cp39-cp39-macosx_11_0_arm64.whl",
            "has_sig": false,
            "md5_digest": "cdfb4a01f3356928d845639d4afbe0ab",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 909731,
            "upload_time": "2023-08-29T00:04:36",
            "upload_time_iso_8601": "2023-08-29T00:04:36.923213Z",
            "url": "https://files.pythonhosted.org/packages/1b/ca/2192652b62b40b1f8853643369ff00a8ed305b18968ed33c8bc0dd710031/krb5-0.5.1-cp39-cp39-macosx_11_0_arm64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22dc68f9676de8405c48b68b47dfcc2a81ec865a1c3d63674ec8a36e2bcf6f57",
                "md5": "f8f6ed7c4a2b0f65dae902ee8a96a6d0",
                "sha256": "7125ee240dad951cc0a71e567c51b215238e490e87ad67b1af9a69dd90e63bca"
            },
            "downloads": -1,
            "filename": "krb5-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f8f6ed7c4a2b0f65dae902ee8a96a6d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 221059,
            "upload_time": "2023-08-29T00:04:39",
            "upload_time_iso_8601": "2023-08-29T00:04:39.177876Z",
            "url": "https://files.pythonhosted.org/packages/22/dc/68f9676de8405c48b68b47dfcc2a81ec865a1c3d63674ec8a36e2bcf6f57/krb5-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-29 00:04:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jborean93",
    "github_project": "pykrb5",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "krb5"
}
        
Elapsed time: 0.11018s