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.4.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 850da6f0344d952a1bb6cc8db7cfac6ec3af27d622e2d96b7cb50e9cef786041 |
|
MD5 | af7108517d426f2a135edf5c50390549 |
|
BLAKE2b-256 | d28f73454fc9a9cea3cb77ac9dbdee80eb4ed925b18619aad892fd3a791ee64e |
Hashes for winkerberos-0.4.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa2df3db53c9342703c916909f40d4c48b560bd53985d84dbbdeec1eb2cccdf1 |
|
MD5 | 16816c580eb86dc67ee4c80547de878c |
|
BLAKE2b-256 | a22f70ff4c751a0ca7365c9b2914eebaf20fd7318a9edfe0ef625f7382901c6a |
Hashes for winkerberos-0.4.0-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a325ad49863a9421b9649da72d2826fd60e2b938ee74e778611f8b6c98c14a4c |
|
MD5 | 575fb0f402f50eb389aca4a9c8eb1d22 |
|
BLAKE2b-256 | c6d33b25a210603c572c01278edbc3216b71b68bcca2ecbfb3b81148af8ea780 |
Hashes for winkerberos-0.4.0-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18f935aedf94d8ac5900c17e79afba491fc65a5aa3017a2800a5415b444c9065 |
|
MD5 | 73e06be05110af20205b2f5c617aa905 |
|
BLAKE2b-256 | 616e77c82c44361ba4a8697e3a10ea5eb9ba844813aa5e26ffefcabc3bb9a56e |
Hashes for winkerberos-0.4.0-cp33-cp33m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f833956f85d51e7cf8bc3055655413500b09e9c7130b45adf688c42ee15b42b7 |
|
MD5 | 6b234dfe6e552145d51ae832198c4a91 |
|
BLAKE2b-256 | 09d560bff65625de81f0d83132d7a4cd77da5cc88a881be626d665804347b949 |
Hashes for winkerberos-0.4.0-cp33-cp33m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99931809a35b1aef5c9cd59954e53d84b6a772076ba2d695df533fbf555ef74b |
|
MD5 | 099dc84b324a0319fcaf89b472994541 |
|
BLAKE2b-256 | 4b6d0b8f9d38faab8e4d7f0d572ccc4d1eeb7faa03fdf988c3751f7f89e8e52e |
Hashes for winkerberos-0.4.0-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6029cac80867d11ea678e69118e78b5a1c72361467a9fe991c77bd0c81dff2be |
|
MD5 | a5a8518d14107449261a7cbb06d9d3fc |
|
BLAKE2b-256 | 7af859942fecbb289f2be510db225d6de6f92fbdcc727a2907b1f60becdb8ced |
Hashes for winkerberos-0.4.0-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a8ba59bfce6e43c799de9a1046a2411dcafc6c10810fc58d606b012d13e5c5 |
|
MD5 | 6ab7ecece0c9be7340483256ec7ff9db |
|
BLAKE2b-256 | 0cd579c2b92cea58f0a277e5a6c6f9ece9c8eb370b6c73cd160af064109a3516 |
Hashes for winkerberos-0.4.0-cp26-cp26m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a69aac3377ba1e20edc62d04bb9891373befabebae56392fb875801ba73745c |
|
MD5 | 5bd2296a3e9b6b2e3b7869469743dec7 |
|
BLAKE2b-256 | c130e062460734bf898ce8d26e600326afb31d95ce6ea69ae5a6bcad2df1cd53 |
Hashes for winkerberos-0.4.0-cp26-cp26m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 125db2ac4de22eed700797f5d623cd608414dba83ffaff9dbafde81416949947 |
|
MD5 | 1e93d9bb3f881103291ca10f2f746666 |
|
BLAKE2b-256 | ded7269c65988d1d37e2d158572f1084a009baf99a0169587cf14afce6da4995 |