Scripts and Python bindings for easy LDAP operations.
Project description
ezldap
An object-oriented Python LDAP API and set of bundled scripts to make common LDAP tasks easier.
Although several very comprehensive LDAP API's currently exist (notably
python-ldap
and ldap3
), neither are particularly easy to use and
generally focus more on the specifics of communicating via LDAP rather than
exposing an easy to use high-level API. This package is designed to do that.
The target audience of this package is system administrators and support
staff who are on a timeline and just need to add a user or write a quick
script in a portable manner.
So how is ezldap
different? It is a wrapper around the ldap3
API that gives access to easily perform a number of high-level tasks
like searching an LDAP directory, adding a user and sending them an
email, or resetting someone's password securely. This process is
streamlined by a configuration script that autodetects as many LDAP
configuration values as possible and automates future connections to the
directory server. Additionally, additions to an LDAP directory are performed
using a set of configurable LDIF templates, making it very quick to
customize the behavior of certain actions (like adding a group). Finally,
for most tasks, a command-line interface is provided, for users who just
want to get started doing stuff.
Python example:
import ezldap
with ezldap.auto_bind() as con:
con.add_user('username', 'groupname', 'password')
Command-line example:
# a password will be automatically generated
ezldap add_user username groupname
Installation
You'll need a copy of Python 3.4+.
No other dependencies are necessary,
though pandas
is useful for some use cases.
pip3 install --user git+https://github.com/jstaf/ezldap.git
ezldap config
Configure your LDAP connection details with ezldap config
before using the package.
You do not need to run this script as root.
The connection details/LDIF templates/etc. for ezldap
are stored in ~/.ezldap
.
Though you can store your bind password here for convenience,
I do not recommend doing so, as it will be stored in cleartext.
You may wish to configure the LDIF templates under ~/.ezldap
as well if you intend to use this package's add object functionality.
Running tests
To run the tests, run the following after installation. You will need to have Docker installed - it is used to spawn a test LDAP server to run tests against.
pip3 install pytest pytest-cov pytest-docker docker-compose
pytest
Using this package
For command-line documentation and usage info,
refer to the ezldap
command's built-in documentation
(ezldap -h
and ezldap command -h
).
Keep in mind this package is under active development and may not be appropriate for all use cases.
Functionality is constantly being added, and the API should not yet be considered stable.
For further information, check out the documentation!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ezldap-0.6.4.tar.gz
.
File metadata
- Download URL: ezldap-0.6.4.tar.gz
- Upload date:
- Size: 17.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14a113ef021b9257bd2ae7487415ca39efd2376ab1adbcdb0cd7fa001f460f4e |
|
MD5 | 70b48caea00cd938afb6f6f5b0e44812 |
|
BLAKE2b-256 | 347dd5f24aac5c9d898fb171d1b28a79d554c885134c9d7820a7bc47aa6125b7 |