Coder Social home page Coder Social logo

jstaf / ezldap Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 2.0 198 KB

Making LDAP suck less

Home Page: https://ezldap.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 98.54% Dockerfile 1.46%
ldap ldif python3 centos slapd openldap ubuntu ldap3 python

ezldap's Introduction

ezldap

Build Status Coverage Status PyPI version

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!

ezldap's People

Contributors

jstaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ezldap's Issues

YAMLLoadWarning

Hi,

when using ezldap I get:

ezldap/config.py:21: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

As I understood, this can be fixed using an additional argument in yaml.load:
Loader=yaml.SafeLoader

Cheerio,
Luis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.