requests-credssp is a Python library that enables HTTPS CredSSP authentication for the popular `requests` library. CredSSP is a Microsoft authentication protocol allowing credentials to be delegated to a server for double-hop authentication. It supports CredSSP protocol versions 2 to 6, initial authentication with NTLM or Kerberos, and message encryption. The library is actively maintained, with the latest major release (v2.0.0) in February 2022.
pip install requests-credsspVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `requests-credssp` to perform an HTTP GET request with CredSSP authentication. It initializes `HttpCredSSPAuth` with a username and password (preferably from environment variables for security) and then uses it with a standard `requests.get()` call. The `minimum_version` parameter can be used to specify the required CredSSP protocol version for the server.
Access these properties/methods via `auth.contexts[hostname].<property_or_method>` instead of directly on the `HttpCredSSPAuth` instance.
For compatibility with older Windows servers, ensure your Python environment's OpenSSL (or the system's) is configured to support the necessary cipher suites. Upgrading server OS or using a WinRM certificate for CredSSP on the server can also resolve issues. Setting `minimum_version` in `HttpCredSSPAuth` to a lower value (if acceptable for security) might also help.
Upgrade your Python environment to Python 3.6 or newer.
Install the necessary system packages and the `[kerberos]` extra as documented in the installation instructions.
First, verify that the provided username and password are correct and have appropriate permissions on the target server. If credentials are correct, check the server's TLS/cipher suite compatibility. Consider updating the server's OS, ensuring it has necessary CredSSP/TLS updates, or configuring a stronger WinRM certificate. On the client, ensure your Python's `ssl` module (and underlying OpenSSL) supports ciphers compatible with the server. Debug with `logging.getLogger('requests_credssp').setLevel(logging.DEBUG)`.Ensure both client and server have the latest CredSSP security updates. Alternatively, on the client machine, navigate to 'Computer Configuration > Administrative Templates > System > Credentials Delegation' in `gpedit.msc` and change the 'Encryption Oracle Remediation' policy to 'Enabled' and set the Protection Level to 'Vulnerable' (for testing, not recommended for production) or 'Mitigated' (if the server is still unpatched). The best long-term fix is to patch the server.
Verify that the import statement is `from requests_credssp import HttpCredSSPAuth`. Ensure `requests-credssp` is installed in your current Python environment by running `pip show requests-credssp` and `pip install requests-credssp` if it's missing or outdated.