Skip to main content

Python tool for managing LLDAP servers

Project description

lldap-py

Python client library for managing LLDAP servers lldap/lldap

Usage

This package provides a Python interface to interact with LLDAP servers for user and group management. The idea is that it would be used in an onboarding/offboarding automation script and make similar automation tasks easier.

Quickstart

  1. Install the package.
  2. Create a LLDAPManager with your server URL and credentials.
  3. Use the user and group helpers to perform actions.
from lldap import LLDAPManager

manager = LLDAPManager(
	http_url="http://localhost:17170",
	username="admin",
	password="your-password",
	# Needed for LDAP password changes
	base_dn="dc=example,dc=com",
	ldap_server="ldap://localhost:3890",
)

users = manager.list_users()
groups = manager.list_groups()

user_id = "jdoe"
manager.create_user(
	user_id,
	"jdoe@example.com",
	"Jane Doe",
	"Jane",
	"Doe",
)

group_id = manager.get_group_id("BasicUserGroup")
if group_id is not None:
	manager.add_user_to_group(user_id, group_id)

# Requires base_dn and ldap_server
manager.set_password(user_id, "TempPassw0rd!")

manager.close()

Notes:

  • You can authenticate with token or refresh_token instead of username and password.
  • Set verify_ssl=False if you are connecting to a test server with self-signed certs.

Installation

You can install the package via pip:

pip install lldap-py

https://pypi.org/project/lldap-py

Requirements

  • Python 3.8+
  • requests
  • ldap3
  • toml
  • click

TODO

  • Maybe improve error handling and passing of graphql errors to the user.
  • Add more examples and documentation.
  • Check coverage of tests
  • Add support for costum user and group attributes.

Credit

This project is heavely inspired by and uses alot of code from Zepmann/lldap-cli and JaidenW/LLDAP-Discord

License

MIT

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

lldap_py-0.2.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lldap_py-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file lldap_py-0.2.0.tar.gz.

File metadata

  • Download URL: lldap_py-0.2.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lldap_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 75f4e9b68d1ccf47802e01f0e33bffb898db9c71e01cee1c2383f63dddfffa6a
MD5 013a6bce160d9555ca71022d8c1dfc09
BLAKE2b-256 fc4d1d64056c06dd4b06ccce79b921380d002baaeb173c2adfbf202fa4514c87

See more details on using hashes here.

Provenance

The following attestation bundles were made for lldap_py-0.2.0.tar.gz:

Publisher: publish_pypi.yml on luca2618/lldap-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lldap_py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lldap_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lldap_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16320fe64a069bf50594d08a8a7bb15052b6d74b73fc76fd6e4939d5fc455dd6
MD5 53b3a09f26e4e3da705de14832ee0f83
BLAKE2b-256 2ac4e717afc3e104159b9fe9727e9ac5337df3f38a3ed6809f862f6a4fa483cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for lldap_py-0.2.0-py3-none-any.whl:

Publisher: publish_pypi.yml on luca2618/lldap-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page