A Python CLI tool for managing LDAP directories
Project description
ldapc
A Python CLI tool for querying and managing LDAP directories. Provides a simple subcommand interface to list, search, get, add, and delete users and groups, with persistent configuration and secure credential storage via the OS keychain.
Features
- List all users or groups
- Search users by name/uid, groups by name (case-insensitive substring)
- Get detailed info on a specific user or group
- Add and delete users and groups
- Manage group membership (add/remove users from groups)
- Text, JSON, and YAML output formats
- Persistent configuration in
~/.ldapc/config.yaml - Secure credential storage via OS keychain
- TLS-secured connections with optional certificate verification skip
- Debug logging for troubleshooting
Installation
# From PyPI
pip install ldap-cli
# From source (editable, with dev deps)
pip install -e ".[dev]"
Quick Start
# Configure (host, base DN, bind DN, password)
ldapc configure
# List all users
ldapc list users
# Search for a user
ldapc search user john
# Get user details in YAML
ldapc get user jdoe --yaml
# Skip SSL verification (self-signed certs)
ldapc list users --skip-ssl-verify
Usage
Configure
ldapc configure
Prompts for LDAP host URL, base DN, bind DN, and password. Config is stored in ~/.ldapc/config.yaml; password goes to the OS keychain.
List
ldapc list users # all users
ldapc list groups # all groups
Search
ldapc search user john # users matching "john" (case-insensitive)
ldapc search group admin # groups matching "admin"
Get
ldapc get user jdoe # exact user lookup
ldapc get group devs # exact group lookup
Add / Delete
ldapc add user newuser
ldapc add group newgroup
ldapc delete user olduser
ldapc delete group oldgroup
Group Membership
ldapc user add group jdoe developers # add user to group
ldapc user remove group jdoe developers # remove user from group
Output Formats
ldapc list users --json # JSON output
ldapc list users --yaml # YAML output (simplified, human-friendly)
Global Flags
These flags can appear after any subcommand:
| Flag | Env Var | Description |
|---|---|---|
--debug |
— | Enable debug logging to stderr |
--skip-ssl-verify |
LDAPC_SKIP_SSL_VERIFY=1 |
Skip TLS certificate verification |
--json |
— | Output as JSON |
--yaml |
— | Output as simplified YAML |
Help
ldapc --help # top-level help
ldapc get --help # subcommand help
ldapc --version # show version
Documentation
ldapc --docs # list available doc files
ldapc --docs README.md # render README as rich text
ldapc --docs README.md --page # render with paging
ldapc --docs README.md --markdown # output raw markdown
ldapc --docs docs/README.md --page # view docs/README.md with paging
Running Tests
pip install -e ".[dev]"
python3 -m pytest tests/ -v
With coverage:
python3 -m pytest tests/ --cov=ldapc --cov-report=term-missing
License
MIT — see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ldap_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ldap_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8db60baa929ca7b0b5c2bbc7938312efec311598256980e030c383941a488a97
|
|
| MD5 |
02be8a52ec53a8bf181179c32b44d7d1
|
|
| BLAKE2b-256 |
174c42f2488d778218b2b31af95436aa46296d4481ebebba51b0eda5a0b10140
|