Registry / auth-security / sasl
library0.3.1pypypiunverified

The `sasl` library provides Python bindings for the Cyrus SASL library. It allows Python applications to interact with SASL for authentication and security layer negotiation, typically serving as a low-level component for other protocol implementations. The current version is `0.3.1`, released in June 2021. The project appears to be in a maintenance state with infrequent updates, and known compatibility issues exist with newer Python versions.

pip install sasl
INSTALL
IMPORT
SIG · SASL
S
sasl
auth-securitypythonv0.3.1
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
import sasl client = sasl.Client(...)
The primary interaction is typically through `sasl.Client` or `sasl.Server` objects. Direct import of `saslwrapper` is also possible but less common for public API.

This conceptual quickstart illustrates the basic initialization of a `sasl.Client` instance. As `sasl` is a C binding to the Cyrus SASL library, a truly runnable example requires a pre-configured Cyrus SASL installation on the system and a SASL server to interact with. The `sasl_callback` function is a placeholder for handling authentication challenges. For simpler, pure-Python SASL client/server implementations with clear examples, consider libraries like `pysasl` or `pure-sasl`.

import sasl import os # Note: This is a conceptual example for a SASL client. # The 'sasl' library is a binding to Cyrus SASL, # requiring system-level Cyrus SASL installation and configuration. # A functional quickstart requires a full SASL server setup. # For a pure-Python, more easily runnable SASL client/server, consider 'pysasl'. def my_sasl_interact(challenge): # In a real application, this would prompt the user or retrieve credentials # For this example, we return a placeholder response if challenge: print(f"SASL Challenge: {challenge.decode()}") username = os.environ.get('SASL_USERNAME', 'testuser') password = os.environ.get('SASL_PASSWORD', 'testpass') return f'\0{username}\0{password}'.encode() try: # Initialize a SASL client instance # This assumes a 'myservice' SASL service is configured on the system # and that the client can connect to a SASL server. client = sasl.Client( service='myservice', host='localhost', sasl_callback=my_sasl_interact # Callback to handle challenges ) # Attempt to start authentication using PLAIN mechanism # In a real scenario, this would involve sending/receiving data over a network socket. # For illustration, we just attempt to start the process. initial_response = client.start('PLAIN') print(f"Initial SASL response: {initial_response.decode() if initial_response else 'No initial response'}") # Acknowledge the conceptual nature of this example for direct execution. print("\nNote: A fully runnable example requires a configured Cyrus SASL server and network communication.") except sasl.SASLError as e: print(f"SASL Error during client initialization or start: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingThe `sasl` package, particularly version `0.3.1` and earlier, has known compatibility issues with newer Python 3 versions (e.g., Python 3.8 and above, including 3.11). Installation may fail, or the module might not load correctly.
fix
For Python 3 environments, consider using `sasl3` (a maintained fork) or `pysasl` (a pure-Python alternative) which offer better compatibility and ongoing development. If `sasl` is an indirect dependency, check if its primary consumer library has an updated version or alternative that supports `sasl3` or `pysasl`.
affects: <=0.3.1
gotchaInstallation of the `sasl` Python package requires system-level Cyrus SASL development libraries (e.g., `libsasl2-dev` on Debian/Ubuntu or `cyrus-sasl-devel` on RHEL/CentOS) to be installed. Without these, `pip install sasl` will typically fail with compilation errors like 'sasl/sasl.h: No such file or directory'.
fix
Ensure the necessary Cyrus SASL development libraries are installed on your operating system before attempting to `pip install sasl`.
affects: All versions
gotchaThe `cloudera/python-sasl` project appears to be largely unmaintained since its last release in June 2021. This can lead to a lack of support for new Python features, operating system changes, and modern SASL mechanisms.
fix
Evaluate whether alternative, actively maintained SASL libraries like `sasl3` or `pysasl` better suit your project's needs, especially for new development or if encountering issues with newer Python versions or OS environments. If `sasl` is a transitive dependency, check if the upstream library has an alternative or an updated version that uses a more active SASL binding.
affects: <=0.3.1
Upgrade
Version history
0.3.1latest on PyPI · released Jun 16, 2021
Audit
Dependencies
sixrequiredCompatibility layer for Python 2 and 3, noted as a dependency in older versions.
Cyrus SASL development librariesrequiredThis Python package is a binding to the native Cyrus SASL library, which must be installed on the system.
Agent activity
22 hits · last 30 days
node
17
OpenAI (training)
1
Resources
sasl — pip install sasl · libregistry