A pure python SASL client
Python Makefile
Latest commit 83cd69f Feb 21, 2017 @thobbs Release version 0.4.0
Permalink
Failed to load latest commit information.
debian
puresasl Release version 0.4.0 Feb 21, 2017
redhat Release version 0.4.0 Feb 21, 2017
tests another py34 fix Feb 20, 2017
.gitignore Update .gitignore to ignore build files Sep 21, 2012
.travis.yml Fix requirements installing in Travis config Feb 1, 2016
CHANGES.rst Release version 0.4.0 Feb 21, 2017
LICENSE Initial commit Sep 21, 2012
MANIFEST.in Bump version to 0.1.5, update changelog Sep 17, 2013
README.rst Updating README Sep 30, 2016
setup.cfg RPM packaging Nov 14, 2012
setup.py Release version 0.3.0 Sep 30, 2016
test-requirements.txt Add unittest2 to test-requirements.txt Feb 1, 2016

README.rst

pure-sasl

https://travis-ci.org/thobbs/pure-sasl.png?branch=master

pure-sasl is a pure python client-side SASL implementation.

At the moment, it supports the following mechanisms: ANONYMOUS, PLAIN, CRAM-MD5, DIGEST-MD5, and GSSAPI. Support for other mechanisms may be added in the future. Only GSSAPI supports a QOP higher than auth. Always use TLS!

Both Python 2 and Python 3 are supported.

Example Usage

from puresasl.client import SASLClient

sasl = SASLClient('somehost2', 'customprotocol')
conn = get_connection_to('somehost2')
available_mechs = conn.get_mechanisms()
sasl.choose_mechanism(available_mechs, allow_anonymous=False)
while True:
    status, challenge = conn.get_challenge()
    if status == 'COMPLETE':
        break
    elif status == 'OK':
        response = sasl.process(challenge)
        conn.send_response(response)
    else:
        raise Exception(status)

if not sasl.complete:
    raise Exception("SASL negotiation did not complete")

# begin normal communication
encoded = conn.fetch_data()
decoded = sasl.unwrap(decoded)
response = process_data(decoded)
conn.send_data(sasl.wrap(response))

License

Some of the mechanisms and utility functions are based on work done by David Alan Cridland and Lance Stout in Suelta: https://github.com/dwd/Suelta

pure-sasl is open source under the MIT license.