High level interface to SSPI for Kerberos client auth
Project description
- Info:
See github for the latest source.
About
A native Kerberos SSPI client implementation. This module mimics the API of pykerberos to implement Kerberos SSPI authentication on Microsoft Windows. It supports Python 2.6, 2.7, and 3.3+.
Installation
WinKerberos is in the Python Package Index (pypi). Use pip to install it:
python -m pip install winkerberos
Building and installing from source
You must have the correct version of VC++ installed for your version of Python:
Python 2.6 - Visual Studio 2008 (Professional for 64bit)
Python 2.7 - Visual Studio 2008 (Professional for 64bit)
Python 3.3 - Visual Studio 2010 (Professional for 64bit)
Python 3.4 - Visual Studio 2010 (Professional for 64bit)
Python 3.5+ - Visual Studio 2015 (Any version)
The Microsoft Visual C++ Compiler for Python 2.7 could also be used to build for Python 2.6 and 2.7.
Once you have the required compiler installed, run the following command from the root directory of the WinKerberos source:
python setup.py install
Building HTML documentation
First install Sphinx:
python -m pip install Sphinx
Then run the following command from the root directory of the WinKerberos source:
python setup.py doc
Examples
This is a simplified example of a complete authentication session following RFC-4752, section 3.1:
import winkerberos as kerberos
def send_response_and_receive_challenge(response):
# Your server communication code here...
pass
def authenticate_kerberos(service, user):
# Initialize the context object with a service principal.
status, ctx = kerberos.authGSSClientInit(service)
# GSSAPI is a "client goes first" SASL mechanism. Send the
# first "response" to the server and recieve its first
# challenge.
status = kerberos.authGSSClientStep(ctx, "")
response = kerberos.authGSSClientResponse(ctx)
challenge = send_response_and_receive_challenge(response)
# Keep processing challenges and sending responses until
# authGSSClientStep reports AUTH_GSS_COMPLETE.
while status == kerberos.AUTH_GSS_CONTINUE:
status = kerberos.authGSSClientStep(ctx, challenge)
response = kerberos.authGSSClientResponse(ctx) or ''
challenge = send_response_and_receive_challenge(response)
# Decrypt the server's last challenge
kerberos.authGSSClientUnwrap(ctx, challenge)
data = kerberos.authGSSClientResponse(ctx)
# Encrypt a response including the user principal to authorize.
kerberos.authGSSClientWrap(ctx, data, user)
response = kerberos.authGSSClientResponse(ctx)
# Complete authentication.
send_response_and_receive_challenge(response)
Viewing API Documentation without Sphinx
Use the help function in the python interactive shell:
>>> import winkerberos
>>> help(winkerberos)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for winkerberos-0.6.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dc14a74082f26ef8d8ef4c62dce4ae56af80303f9acc87b9c1a60c2e5d068c4 |
|
MD5 | 616a37d33b9ae6b24a32745297f56edd |
|
BLAKE2b-256 | 5b30c9aaca4d6ed79796216e9577820f40dcb0bd66eddbfeeebe503774120203 |
Hashes for winkerberos-0.6.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 097501bf6a3c090e8413e6d435217ef864f87ff943fb57dac2d9b18a850b5644 |
|
MD5 | 3e977acb7a63bf3503dba4216f87cba2 |
|
BLAKE2b-256 | 336fa002ba02eaa9315f23a43a00ea5259694c670340ed38951e92f00cf7769d |
Hashes for winkerberos-0.6.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0137f78733d6056b9dd305fe6524502317e7b2e3af5595f104f9f626fb78b88 |
|
MD5 | 4b4e1439df9420b7da789026cf00be46 |
|
BLAKE2b-256 | e6b28070676d08b6bfc3035cb9378d0ab8579d8e22b4f80813e577d0fac3b9a6 |
Hashes for winkerberos-0.6.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25f84312b0ac6e6fee20065bc7277911f2663f2f8c97ad75620ad70a52a904da |
|
MD5 | 92c49cc965aa8fbaead5ce14630923b5 |
|
BLAKE2b-256 | 92829bfc2c852097b1d620310fcd4e7f56f6500b768b555f803a3c65d3e14ee3 |
Hashes for winkerberos-0.6.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 753dcce1c806fb017b1ae519989cf8b35d8a37f03d58e7041870c4367580abda |
|
MD5 | 9b0e74aac80eb00eaabb34bc9ac7d344 |
|
BLAKE2b-256 | a84cbba7ccef4c643b4fab093238d6e464e3fb5f6a5e0b8d8fe62a8a3db5e8e9 |
Hashes for winkerberos-0.6.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44190d79681da4a2ac75bcbf6807c11dac15b6757c48bca12e18a58e33fab718 |
|
MD5 | 8a0f8d654bced10b005fcb0ec7a34601 |
|
BLAKE2b-256 | 01421979b1c9dc09889844e45162adff9576e6043997c859458d80499fdf54fb |
Hashes for winkerberos-0.6.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2481764abc941ec893f37b0949db19f11b5399429d9f119b100e24051c9de696 |
|
MD5 | a5133f8d9f56bf8db6945f0a0cca7a94 |
|
BLAKE2b-256 | 484b62d0c828c296d2d44ddcffd8d0b2d413167a092956e25aae32e645d9b786 |
Hashes for winkerberos-0.6.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aefaed2deb73e5528db0876a5f5738ff875a7f598c33648e0545577dd962ac2 |
|
MD5 | 0e6c04373783e7bf26ca2ea2d3d77aa9 |
|
BLAKE2b-256 | e106d728091efcd9115da9615ece0b4bf111776b0de0ce1fa460cc942898e092 |
Hashes for winkerberos-0.6.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38593e16e412eac74cac2598978c67de06d10bb29b4cf9584a023e1c018daa08 |
|
MD5 | 117693928bea3b23c04462b27c70e94e |
|
BLAKE2b-256 | a995f5b0543341fdbd2f1a017c4592e1a8336abc17f24b552e2ada03c61e5944 |
Hashes for winkerberos-0.6.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb1858e1c1ead9eaef80e49f1e8a6a3fc46f6524412c9317456a56a8cdccf3ab |
|
MD5 | 25a35889b2cc58f73b09f39452e489a3 |
|
BLAKE2b-256 | 846bbcfdcc185e892dc5b2adb5a6447d3e92b507e884a5fa5d156ce05455d97f |
Hashes for winkerberos-0.6.0-cp26-cp26m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f992253a0c1e7cf674c36a00c7baf286df29fd7abb1505a15534f09c24857bf7 |
|
MD5 | f7c8a83df6dd3e87f5d3d2335085277f |
|
BLAKE2b-256 | bb86c91df20c1e1cf91501de652087f9a489c918430a2d72754f10912e9c45d4 |
Hashes for winkerberos-0.6.0-cp26-cp26m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec71fdc1b3315c9b1fc7138246e6fce76fd4d61cda6cacc5eb70a5057f3194ef |
|
MD5 | 04f51ad5b28c055422d182cc48d5bd6f |
|
BLAKE2b-256 | 9a87e2bc49ab2616b282c80c7868b79e9eb19b3f1b887d1574310ba899cfe464 |