Skip to main content

oarepo Kerberos

Library that handles the kerberos authentication

Local Setup

Go to setup_local_kdc folder

  1. docker build -t custom-kerberos-kdc .

  2. docker run -d --name kerberos-kdc -p 2222:88 -p 2223:464 custom-kerberos-kdc

  3. docker exec -it kerberos-kdc /bin/bash

  4. kadmin.local -q "addprinc admin/admin@EXAMPLE.COM" (choose password)

  5. kadmin.local -q "addprinc user@EXAMPLE.COM" (choose password)

  6. kadmin.local -q "addprinc -randkey HTTP/localhost@EXAMPLE.COM"

  7. kadmin.local -q "ktadd -k /etc/krb5kdc/flask.keytab HTTP/localhost@EXAMPLE.COM"

  8. docker cp kerberos-kdc:/etc/krb5kdc/flask.keytab ./flask.keytab

  9. Setup env variable KRB5_KTNAME to location of flask.keytab and set app.config['GSSAPI_HOSTNAME'] = 'localhost'

  10. change/create file /etc/krb5.conf to or export KRB5_CONFIG=./setup_local_kdc/krb5-client.conf:

[libdefaults]
    default_realm = EXAMPLE.COM
    dns_lookup_kdc = false
    dns_lookup_realm = false
    ticket_lifetime = 24h
    renew_lifetime = 7d
    forwardable = true

[realms]
    EXAMPLE.COM = {
        kdc = localhost:2222
        admin_server = localhost:2223
    }

[domain_realm]
    .example.com = EXAMPLE.COM
    example.com = EXAMPLE.COM

  1. kinit user@EXAMPLE.COM or another username created in step 5

Limitations

Multi-leg SPNEGO is not supported

Authentication must complete in a single round trip. The negotiation cannot be resumed either — a fresh GSSAPI security context is built per request, and the continuation token is discarded unless that context completed — so a request needing a second leg is answered with 501 Not Implemented.

A session cookie and a Negotiate token cannot be combined

Successful Kerberos authentication logs the user in, which sets a session cookie. If a client then sends that cookie and Authorization: Negotiate ... on a later request, it is presenting two credentials that may name different principals, so the server refuses with 400 Bad Request rather than silently picking one.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo_kerberos-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oarepo_kerberos-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file oarepo_kerberos-0.1.0.tar.gz.

File metadata

  • Download URL: oarepo_kerberos-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for oarepo_kerberos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d184bf34bd1135d9242de920cde13029a1995e313849fdb43734b36a36fcb6d
MD5 cc8c4deb18e66002075c11a936648081
BLAKE2b-256 976015c4654dcd2df25a152ce98dbbc5420994ca734f3ed50ec388e0765ba72d

See more details on using hashes here.

File details

Details for the file oarepo_kerberos-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for oarepo_kerberos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd2537e39655d94a873b5453109b6685750f4afeb75d5c88bba81742297510e2
MD5 08456b6cffdcc8b2309163f0142538d0
BLAKE2b-256 9f9f654ed3908ecd1172fc0822659f7741add386ed23d2ed2f690623863d69b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page