
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
A modern LDAP client CLI tool inspired by HTTPie, using ldap3 for LDAP operations and Rich for beautiful terminal output.
LDAPie makes LDAP operations more accessible and intuitive with a modern command-line interface, beautiful output, and comprehensive features for both beginners and LDAP experts.
# Clone the repository
git clone https://github.com/ruslanfialkovskii/ldapie.git
cd ldapie
# Create a virtual environment and install dependencies
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Make the wrapper scripts executable
chmod +x ldapie ldapie.sh
# Try the automated demo with a mock LDAP server
./ldapie.sh --demo
# Install shell completion (optional)
./ldapie --install-completion
The automated demo will showcase all major features of LDAPie using a mock LDAP server, so you don't need a real LDAP server to get started.
The easiest way to install LDAPie is via pip from PyPI:
# Install globally (may require sudo)
pip install ldapie
# Install in user space
pip install --user ldapie
# Install in a virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate
pip install ldapie
After installation, you can use the ldapie
command directly:
# Check if installation was successful
ldapie --version
# Run the demo to explore features
ldapie --demo
# Create a virtual environment (optional but recommended)
python3 -m venv venv
source venv/bin/activate
# Clone the repository
git clone https://github.com/ruslanfialkovskii/ldapie.git
cd ldapie
# Install from source
pip install .
# Alternatively, install in development mode
pip install -e .
# Make the wrapper script executable
chmod +x ldapie
# Use the wrapper script directly
./ldapie search localhost "dc=example,dc=com"
# Build the Docker image
docker build -t ldapie .
# Run using Docker
docker run -it ldapie search ldap.example.com "dc=example,dc=com"
LDAPie requires the following Python packages, which will be automatically installed by pip:
LDAPie provides shell completion for Bash, Zsh, and Fish:
# Install shell completion
./ldapie --install-completion
# Show completion script without installing
./ldapie --show-completion
LDAPie provides a command-line interface for LDAP operations:
ldapie search <host> <base_dn> [<filter>] [options]
ldapie info <host> [options]
ldapie compare <host> <dn1> <dn2> [options]
ldapie schema <host> [<object_class>] [options]
ldapie add <host> <dn> [options]
ldapie modify <host> <dn> [options]
ldapie delete <host> <dn> [options]
ldapie rename <host> <dn> <new_rdn> [options]
ldapie interactive [options]
LDAPie includes a comprehensive context-sensitive help system that provides smart suggestions based on your current context and command history:
--validate
flag to check and preview commands without executionExamples:
# Get help for a partial command
./ldapie search?
# Validate a command without executing it
./ldapie search ldap.example.com "dc=example,dc=com" --validate
# Get help during interactive mode
ldapie> search?
# Basic search
./ldapie search ldap.example.com "dc=example,dc=com"
# Search with filter
./ldapie search ldap.example.com "dc=example,dc=com" "(objectClass=person)"
# Authenticate with username and password
./ldapie search ldap.example.com "dc=example,dc=com" "(uid=admin)" -u "cn=admin,dc=example,dc=com" -p secret
# Specify attributes to retrieve
./ldapie search ldap.example.com "dc=example,dc=com" "(cn=*)" -a cn -a mail -a uid
# Use SSL/TLS
./ldapie search ldaps.example.com "dc=example,dc=com" --ssl
# Output in JSON format
./ldapie search ldap.example.com "dc=example,dc=com" --json
# Output in LDIF format
./ldapie search ldap.example.com "dc=example,dc=com" --ldif
# Output in CSV format
./ldapie search ldap.example.com "dc=example,dc=com" --csv
# Display results as a tree
./ldapie search ldap.example.com "dc=example,dc=com" --tree
# Secure password handling (will prompt for password)
./ldapie search ldap.example.com "dc=example,dc=com" -u "cn=admin,dc=example,dc=com"
# Limit search results
./ldapie search ldap.example.com "dc=example,dc=com" --limit 10
# Save results to a file
./ldapie search ldap.example.com "dc=example,dc=com" --json --output results.json
# Get server information
./ldapie info ldap.example.com
# Authenticate to get server information
./ldapie info ldap.example.com -u "cn=admin,dc=example,dc=com" -p secret
# Compare two LDAP entries
./ldapie compare ldap.example.com "uid=user1,ou=people,dc=example,dc=com" "uid=user2,ou=people,dc=example,dc=com"
# Compare specific attributes
./ldapie compare ldap.example.com "uid=user1,ou=people,dc=example,dc=com" "uid=user2,ou=people,dc=example,dc=com" -a uid -a cn -a mail
# Get a list of all object classes
./ldapie schema ldap.example.com
# Get information about a specific object class
./ldapie schema ldap.example.com person
# Get information about a specific attribute
./ldapie schema ldap.example.com --attr mail
# Add a simple entry
./ldapie add ldap.example.com "cn=newuser,ou=people,dc=example,dc=com" --class inetOrgPerson --attr cn=newuser --attr sn=User --attr uid=newuser -u "cn=admin,dc=example,dc=com"
# Add an entry from LDIF file
./ldapie add ldap.example.com --ldif entries.ldif -u "cn=admin,dc=example,dc=com"
# Add an entry from JSON file
./ldapie add ldap.example.com "cn=newgroup,ou=groups,dc=example,dc=com" --json group.json -u "cn=admin,dc=example,dc=com"
# Add a value to an attribute
./ldapie modify ldap.example.com "cn=user1,ou=people,dc=example,dc=com" --add mail=user1@example2.com -u "cn=admin,dc=example,dc=com"
# Replace an attribute value
./ldapie modify ldap.example.com "cn=user1,ou=people,dc=example,dc=com" --replace mobile=555-1234 -u "cn=admin,dc=example,dc=com"
# Delete an attribute value
./ldapie modify ldap.example.com "cn=user1,ou=people,dc=example,dc=com" --delete mail=user1@example.com -u "cn=admin,dc=example,dc=com"
# Delete an entire attribute
./ldapie modify ldap.example.com "cn=user1,ou=people,dc=example,dc=com" --delete mobile -u "cn=admin,dc=example,dc=com"
# Delete an entry
./ldapie delete ldap.example.com "cn=user1,ou=people,dc=example,dc=com" -u "cn=admin,dc=example,dc=com"
# Delete an entry and all its children (recursive)
./ldapie delete ldap.example.com "ou=people,dc=example,dc=com" --recursive -u "cn=admin,dc=example,dc=com"
# Rename an entry (change RDN)
./ldapie rename ldap.example.com "cn=user1,ou=people,dc=example,dc=com" "cn=user1renamed" -u "cn=admin,dc=example,dc=com"
# Move an entry to a different location
./ldapie rename ldap.example.com "cn=user1,ou=people,dc=example,dc=com" "cn=user1" --parent "ou=admins,dc=example,dc=com" -u "cn=admin,dc=example,dc=com"
# Start interactive mode
./ldapie interactive
# Start interactive mode and connect to a server
./ldapie interactive --host ldap.example.com --user "cn=admin,dc=example,dc=com" --base "dc=example,dc=com"
# Start interactive mode with SSL
./ldapie interactive --host ldap.example.com --ssl --base "dc=example,dc=com"
In interactive mode, you can use commands like:
connect ldap.example.com 389 admin --ssl
- Connect to serverls
- List entries in current base DNcd ou=people,dc=example,dc=com
- Change base DNsearch "(objectClass=person)" cn mail
- Search for entriesshow 0
- Show first entry from last searchadd cn=user,ou=people,dc=example,dc=com person cn=User sn=User
- Add entrydelete cn=user,ou=people,dc=example,dc=com
- Delete entryhelp
- Show all available commandsLDAPie supports several methods for securely handling passwords:
The most secure method is to not specify the password on the command line and let the tool prompt for it:
./ldapie search ldap.example.com "dc=example,dc=com" -u "cn=admin,dc=example,dc=com"
# You'll be prompted to enter password securely
If you need to provide passwords containing special shell characters on the command line:
Use single quotes to prevent shell interpretation:
./ldapie search ldap.example.com "dc=example,dc=com" -u "user" -p 'password!with#special@chars'
Use environment variables:
export LDAP_PASSWORD="password!with#special@chars"
./ldapie search ldap.example.com "dc=example,dc=com" -u "user" -p "$LDAP_PASSWORD"
Escape special characters:
./ldapie search ldap.example.com "dc=example,dc=com" -u "user" -p "password\!with\#special\@chars"
./ldapie --help
./ldapie search --help
./ldapie info --help
./ldapie compare --help
./ldapie schema --help
./ldapie add --help
./ldapie modify --help
./ldapie delete --help
./ldapie rename --help
./ldapie interactive --help
LDAPie supports light and dark themes that can be set through the --theme
option or environment variable:
# Set theme using command-line option
./ldapie search ldap.example.com "dc=example,dc=com" --theme light
# Set theme using environment variable
LDAPIE_THEME=light ./ldapie search ldap.example.com "dc=example,dc=com"
LDAPie is available as a Docker container, making it easy to use without installing Python or dependencies on your local machine.
# Pull the latest image from Docker Hub
docker pull ruslanfialkovskii/ldapie:latest
# Run the help command to verify it works
docker run --rm ruslanfialkovskii/ldapie:latest --help
# Run the demo to explore LDAPie's features
docker run --rm ruslanfialkovskii/ldapie:latest --demo
The container can be used just like the regular command-line tool:
# Basic LDAP search
docker run --rm ruslanfialkovskii/ldapie:latest search ldap.example.com "dc=example,dc=com" "(objectClass=*)"
# Search with authentication
docker run --rm ruslanfialkovskii/ldapie:latest search ldap.example.com "dc=example,dc=com" \
"(objectClass=person)" --username "cn=admin,dc=example,dc=com" --password secret
# Output results in JSON format
docker run --rm ruslanfialkovskii/ldapie:latest search ldap.example.com "dc=example,dc=com" \
"(objectClass=person)" --json
# Get server info
docker run --rm ruslanfialkovskii/ldapie:latest info ldap.example.com
Interactive mode requires some additional Docker parameters:
docker run --rm -it ruslanfialkovskii/ldapie:latest interactive
The -it
flags ensure that Docker allocates a pseudo-TTY and keeps STDIN open, which is necessary for interactive mode to work properly.
To save output to files or read input files, you'll need to mount a volume:
# Mount the current directory to /data in the container
docker run --rm -v $(pwd):/data ruslanfialkovskii/ldapie:latest search ldap.example.com \
"dc=example,dc=com" "(objectClass=*)" --output /data/results.json --json
If you prefer to build the container yourself:
# Clone the repository
git clone https://github.com/ruslanfialkovskii/ldapie.git
cd ldapie
# Build the image
docker build -t ldapie .
# Run your local image
docker run --rm ldapie --help
The container supports the following environment variables:
LDAPIE_THEME
: Set to "light" or "dark" to control the color themeLDAPIE_DEFAULT_SERVER
: Default LDAP server hostnameExample:
docker run --rm -e LDAPIE_THEME=light ruslanfialkovskii/ldapie:latest --help
latest
: Most recent stable releasedev
: Development versionx.y.z
(e.g., 0.1.1
): Specific version releasesThe LDAPie container is lightweight and requires minimal resources. For most operations, the default Docker resource limits are sufficient.
For operations on very large LDAP directories, you may need to increase the memory limit:
docker run --rm --memory=512m ruslanfialkovskii/ldapie:latest search ldap.example.com \
"dc=example,dc=com" "(objectClass=*)" --page-size 1000
For more detailed information about using LDAPie in containers, see CONTAINER.md.
For information on setting up a development environment, contributing to the project, and the release process, see DEVELOPMENT.md.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
FAQs
A modern LDAP client CLI tool inspired by HTTPie
We found that ldapie demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.