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, just run the following command:
python setup.py install
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)
Documentation
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.3.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39ba4216d992374a82cd100e1abac28edf736df2349062c43f5934232118a84 |
|
MD5 | 5124a9821a5889262e3c4efffabed6a9 |
|
BLAKE2b-256 | 8d9c15750b8d0e4ef58911b03ce95ae07d9008a9cdf75e08f4a8e4223fd32b06 |
Hashes for winkerberos-0.3.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50dcd2f206b17cd93ec30e2317e4e3b537ddd1668b7b863c60e45edd16111e65 |
|
MD5 | 9097d6953705ce0f1eaa7cb0153a1772 |
|
BLAKE2b-256 | 15380cce736a9d45d2f9eb52d22c0cad000d83439a0960b4331049c4f2b518bb |
Hashes for winkerberos-0.3.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b219b3326667d0613ecbf5f53887896fe47e8cdff6d4ac75f660e7b0c0c59d3 |
|
MD5 | 75e48dd4ae272d9deb5443a8a31a3e78 |
|
BLAKE2b-256 | 9566c5e5f62a6fdc7ff470daabf386b79041d8dd76e174a434930bda71187501 |
Hashes for winkerberos-0.3.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad08b8bb1ee2941031fd1f414ee6683135be528d8a254ddc04adf30d9c67575e |
|
MD5 | 539cf3e23b4fcd4f83d808269dba5756 |
|
BLAKE2b-256 | 67d941c9d8f4d066d233d593fee36aa1b46301872e3979c7b0186a4cf1e9790f |
Hashes for winkerberos-0.3.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 890368441e0405528e9ccab55f9e21f595fd4d963a44f6731f476f62f54f4ba9 |
|
MD5 | da2eb6f2f5d78133ae312cb7971fcd43 |
|
BLAKE2b-256 | 39fea4ef9784c68523b9421381dc245b4be2ba7f81f9fbbae3b64c8dacf4224e |
Hashes for winkerberos-0.3.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb40c779851e0ef252bc3ddc717735d33bb2b0bf682b7d009ce474c413e85d6 |
|
MD5 | b523712bd88c6398115a7e3e2fb8e230 |
|
BLAKE2b-256 | d492f4c2b6c88aec16f7ddcf1b09f583a6e275e73cb827550466fab900e65ec5 |
Hashes for winkerberos-0.3.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6fc433d642ed70cf1a259199c69ce8a9c0ce898115b233e9d0678d1614c0acb |
|
MD5 | adc05fe63bb4f7bac1d8dcd88ebae940 |
|
BLAKE2b-256 | 873e346b13dae59651214a2a1dd2cc159bc1ebaa58583fe004049941a71951ff |
Hashes for winkerberos-0.3.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3555d16a92d6c99e4f1f579f20a4a298c22be84a495ff3ab17926dad42b65f50 |
|
MD5 | 28b4b527fc9b3621589aabf0045e952c |
|
BLAKE2b-256 | d3ecad0bdf8ed6bad0632a29d283847722abc8040af6185068aece5b06e18e56 |
Hashes for winkerberos-0.3.0-cp26-cp26m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c0d8031445cd446df48c6764a61813dbf8d6de52404b6bd96bdd868952c56c9 |
|
MD5 | 0b2ac4453452739bcec348b3ac0328b0 |
|
BLAKE2b-256 | 156cd2e3aabd2101185ff7f075962a9834534714559bd2685450260a8ed9a28d |
Hashes for winkerberos-0.3.0-cp26-cp26m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee0b581a58d907caa41d19ecef3940ddbe7da36bf9aead6a547839d10d31edbd |
|
MD5 | 8a3b77c03f789a9d27cf6b8234ab0591 |
|
BLAKE2b-256 | cc42006c1209afe754b9a7aa11c8213e6a2764126295624655584ec0dc24c564 |