Windows Negotiate Authentication Client and Server
Project description
Python SPNEGO Library
Library to handle SPNEGO (Negotiate, NTLM, Kerberos) and CredSSP authentication. Also includes a packet parser that can be used to decode raw NTLM/SPNEGO/Kerberos tokens into a human readable format.
Requirements
See How to Install for more details
- CPython 3.6+
- cryptography
Optional Requirements
The following Python libraries can be installed to add extra features that do not come with the base package:
- python-gssapi and pykrb5 for Kerberos authentication on Linux
- ruamel.yaml for YAML output support on
pyspnego-parse
How to Install
To install pyspnego with all basic features, run
pip install pyspnego
Kerberos Authentication
While pyspnego supports Kerberos authentication on Linux, it isn't included by default due to its reliance on system packages to be present.
To install these packages, run the below
# Debian/Ubuntu
apt-get install gcc python3-dev libkrb5-dev
# Centos/RHEL
yum install gcc python-devel krb5-devel
# Fedora
dnf install gcc python-devel krb5-devel
# Arch Linux
pacman -S gcc krb5
Once installed you can install the Python packages with
pip install pyspnego[kerberos]
Kerberos also needs to be configured to talk to the domain but that is outside the scope of this page.
While NTLM auth works out of the box, it is recommended to install the gss-ntlmssp library for full Negotiate support. This can be done with
# Debian/Ubuntu
apt-get install gss-ntlmssp
# Centos/RHEL
yum install gssntlmssp
# Fedora
dnf install gssntlmssp
# Arch Linux
# AUR package https://aur.archlinux.org/packages/gss-ntlmssp/
How to Use
See the examples section for examples on how to use the authentication side of the library.
Note: While server/acceptor authentication is available for all protocols it is highly recommended you have the system GSSAPI and NTLM system libraries present for acceptor authentication. Pyspnego NTLM acceptor authentication should work but it is not as thoroughly tested as the GSSAPI implementation.
CredSSP Authentication
Since version 0.2.0, pyspnego can be used for CredSSP authentication. While this isn't part of the SPNEGO/Negotiate
protocol it uses common features and code like ASN.1 structures and even Negotiate auth as part of the CredSSP process.
Both initiate
and accept
usages are supported when specifying protocol='credssp'
but there are no guarantees the
acceptor is free of any bugs so use with caution.
Backlog
- Add support for anonymous authentication
- See if
pywinrm
wants to use this
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 pyspnego-0.5.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70a691c9cf9839081a451e80add049aca68cb237cd9146a689d84ae3b310103c |
|
MD5 | 192c06234bfeb2ba5db6ed0123e7149a |
|
BLAKE2b-256 | f32f3c0545ec334d539b924b00b787a59e5ea7573f3429eed7edc72e82ff5e70 |
Hashes for pyspnego-0.5.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9360b9cea376d0431bd9803cecc7160e6f9abd1c4ca4f9c1f8cf40f49050ddb |
|
MD5 | d8ce5d81bb235f59852bd1f10663be48 |
|
BLAKE2b-256 | b001ef3035bb1b6e01ff186dc118a452033c19c25e84d0530502b8aacb61e4b6 |
Hashes for pyspnego-0.5.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d87a8ab7f286db6e07682c14f9fe2cdb10ccbbb67b1f65aaa298ba1fe66db894 |
|
MD5 | 3b4c73c194dbcac561927a2b24a61c88 |
|
BLAKE2b-256 | 872b4e45e3da2c4f5e7d4cb75030ea266c245b351497a714983159b568cd3489 |
Hashes for pyspnego-0.5.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c54d77c19fdbf67b4877dbb6f51d19168eed36f69c6b9072a739475ce174f38 |
|
MD5 | 53fa9228204129020f91a1bea104833d |
|
BLAKE2b-256 | 0e0ff0b59557a57dd58510f03e3003440a9a6b8c9b8c6ba488db21112a5ab91b |
Hashes for pyspnego-0.5.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7b518585a3393c3152ca799d2c7b20684b37365176dca5d0672cdc22789271 |
|
MD5 | 16c43947e6ff9d1a192f6045f08aebc7 |
|
BLAKE2b-256 | 3c8904e3d2e11b63030bf9327dd1b69a6eda3e304398f827b457041dac76a4a7 |
Hashes for pyspnego-0.5.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52689c4c9349543f451bb9eb94c35f12f114ef6ef0723b39c5b9845b715e01fd |
|
MD5 | d014f60070988183b0e82f78dcb24eb7 |
|
BLAKE2b-256 | be2c55b4f04e9ade8d0e8d250aad595a622709b55b65eaa2c8062e98ed73a2f7 |
Hashes for pyspnego-0.5.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 660d61461ab70c23bc1e97845fa02137df6e5007922a346a5eb32c1b081d8845 |
|
MD5 | 774e17faa9cc51dbe617d41c95e3f5ec |
|
BLAKE2b-256 | 082b36d72767e2626084addeec5f91066eadd8a27fa43b959a30980cd978eddd |
Hashes for pyspnego-0.5.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cd2574023077cc6a388c2b611bedbe66648d6fa2dad5806f075e43eaf438897 |
|
MD5 | 721c42c0eaabab19f34886a9776a9b8b |
|
BLAKE2b-256 | 3f4a1d9181f2b1e99aae1313840b7c68d04ae803a37a6f030ea728150b4105c2 |
Hashes for pyspnego-0.5.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9fbbf09d6d6acb4aa7b8591b30f53cc66d5bf5f826094ab274b9585c43f7e43 |
|
MD5 | f01304396bff3d942af1e9647f48331b |
|
BLAKE2b-256 | 91a61db9b5c1737ce4036c03a02a6b9116803713a9396d17ffb429ee6e3d857b |
Hashes for pyspnego-0.5.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfa5f5de5a87f56cd8132955a3ad7cd6a6b9719f06401ca7660023df6404dcc3 |
|
MD5 | ec95e727141936deb4a80cb3c34875b2 |
|
BLAKE2b-256 | 7e7dc69f9536bc64dd073f6d45509d6a30206914408a2930b133acf77db9ea58 |
Hashes for pyspnego-0.5.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5110372dd7a15cbab0c496103f31bc1147e152422efa70bb29dd3f984387cdbd |
|
MD5 | dbef37c1507b7cf3820b1a37d09f980c |
|
BLAKE2b-256 | 95d47a487638d5a740d2f0ad0a893edba74145efad18358032bd7c29e8804b92 |