A client for the Dovecot Authentication Protocol v1.1.
Why?
Dovecot is a convenient authentication backend for some stuff running on my server, most notably the OpenID provider it looks as if I’m going to have to write, and it’s less trouble to write a small client to talk to it than get something talking to PAM.
I figure that somebody might be in the same position, so why not unbundle it from the OpenID provider.
Development
To set up your development environment, run:
make dev
To upload a new release to PyPI:
make release
Usage
Use the connect context manager to connect to a DAP server. This takes a service name (such as ‘imap’) and either a path to a Unix domain socket or in the unix named parameter, or a tuple consisting of a hostname and port number in the inet named parameter.
The context manager returns a Protocol object, on which you can called the auth method. This takes the name of a SASL mechanism (currently only ‘PLAIN’ is supported), a username, and a password, as well as a number of additional arguments optional arguments, which I need to document.
The return value is a two tuple, consisting of a boolean indicating success or failure and the arguments of the response as a dictionary, or None, indicating a CONT response and that further data is needed.
For instance:
with connect('imap', unix='./auth.sock') as conn:
status, flags = conn.auth('imap', username, password)
if status:
print("Authentication succeeded")
else:
print("Authentication failed or needs more data")
Demos
The library comes with two demonstrations, allowing you to test it out separately from Dovecot itself. Running dovecotauth.py server will give you a simple DAP server, and dovecotauth.py client gives you a command-line client. Note, however, that both are not intended to be robust, but just to give you enough to test things out.
Both share two flags --unix and --inet. The former lets you specify a Unix domain socket path, and the latter allows you to specify an address to bind/connect to in the form address:port.
The client also allows you to specify the service name with the --service flag (‘imap’ by default), the SASL mechanism to use with the --mech flag (currently only ‘PLAIN’ is supported, so this can be ignored for now), and a username, which defaults to the value of the USER environment variable.
For example:
./dovecotauth.py client --unix ./auth.sock --user user
You will then be prompted for a password.
The server takes a flag, --htpasswd, which allows you to specify the path to a htpasswd file to authenticate against:
./dovecotauth.py server --unix ./auth.sock --htpasswd ./passwd
Metadata
Release files for dovecotauth 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dovecotauth-1.0.1.tar.gz | 6.3 kB | Without provenance | Details for dovecotauth-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dovecotauth-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for dovecotauth-1.0.1-py3-none-any.whl |
Total release size: 20.6 kB
Release files / dovecotauth-1.0.1.tar.gz
| Download URL | dovecotauth-1.0.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ec0b4a04ece4de2df9790ec5116a592e80978fb747fce9ac6c712db6715c070
|
|
BLAKE2b-256 checksum How to use checksums |
5cda74b6743956562db79de3d44985196dc830be947ad91cebd2eafd03bf0c70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.21.0
|
Release files / dovecotauth-1.0.1-py3-none-any.whl
| Download URL | dovecotauth-1.0.1-py3-none-any.whl |
|---|---|
| Size | 14.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fe0a0c804a59683384ddc1674e78a891ec27cd8276e2425dbbec1e97752b74f
|
|
BLAKE2b-256 checksum How to use checksums |
9e23797733860acb1bf4ef8559891d68357aaadacab11bb0dcf47df4f525079e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.21.0
|
Security for dovecotauth 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.