ldap-cli 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .kiro/specs/ldap-cli/design.md +386 -0
- .kiro/specs/ldap-cli/requirements.md +123 -0
- .kiro/specs/ldap-cli/tasks.md +246 -0
- CHANGELOG.md +47 -0
- README.md +145 -0
- docs/reference.md +198 -0
- ldap_cli-0.2.0.dist-info/METADATA +176 -0
- ldap_cli-0.2.0.dist-info/RECORD +18 -0
- ldap_cli-0.2.0.dist-info/WHEEL +4 -0
- ldap_cli-0.2.0.dist-info/entry_points.txt +2 -0
- ldap_cli-0.2.0.dist-info/licenses/LICENSE +21 -0
- ldapc/__init__.py +7 -0
- ldapc/_version.py +23 -0
- ldapc/cli.py +490 -0
- ldapc/config.py +184 -0
- ldapc/exceptions.py +37 -0
- ldapc/formatter.py +282 -0
- ldapc/ldap_client.py +506 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ldap-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Python CLI tool for managing LDAP directories
|
|
5
|
+
Project-URL: Homepage, https://github.com/tmb28054/ldap-cli
|
|
6
|
+
Author-email: Topaz Bott <topaz@topazhome.net>
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: keyring<26.0,>=25.0
|
|
20
|
+
Requires-Dist: ldap3<3.0,>=2.9
|
|
21
|
+
Requires-Dist: pyyaml<7.0,>=6.0
|
|
22
|
+
Requires-Dist: rich<14.0,>=13.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: bandit<2.0,>=1.7; extra == 'dev'
|
|
25
|
+
Requires-Dist: hypothesis<7.0,>=6.100; extra == 'dev'
|
|
26
|
+
Requires-Dist: mypy<2.0,>=1.10; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov<6.0,>=5.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest<9.0,>=8.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff<1.0,>=0.4; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# ldapc
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- List all users or groups
|
|
39
|
+
- Search users by name/uid, groups by name (case-insensitive substring)
|
|
40
|
+
- Get detailed info on a specific user or group
|
|
41
|
+
- Add and delete users and groups
|
|
42
|
+
- Manage group membership (add/remove users from groups)
|
|
43
|
+
- Text, JSON, and YAML output formats
|
|
44
|
+
- Persistent configuration in `~/.ldapc/config.yaml`
|
|
45
|
+
- Secure credential storage via OS keychain
|
|
46
|
+
- TLS-secured connections with optional certificate verification skip
|
|
47
|
+
- Debug logging for troubleshooting
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# From PyPI
|
|
53
|
+
pip install ldap-cli
|
|
54
|
+
|
|
55
|
+
# From source (editable, with dev deps)
|
|
56
|
+
pip install -e ".[dev]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Configure (host, base DN, bind DN, password)
|
|
63
|
+
ldapc configure
|
|
64
|
+
|
|
65
|
+
# List all users
|
|
66
|
+
ldapc list users
|
|
67
|
+
|
|
68
|
+
# Search for a user
|
|
69
|
+
ldapc search user john
|
|
70
|
+
|
|
71
|
+
# Get user details in YAML
|
|
72
|
+
ldapc get user jdoe --yaml
|
|
73
|
+
|
|
74
|
+
# Skip SSL verification (self-signed certs)
|
|
75
|
+
ldapc list users --skip-ssl-verify
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
### Configure
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
ldapc configure
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Prompts for LDAP host URL, base DN, bind DN, and password. Config is stored in `~/.ldapc/config.yaml`; password goes to the OS keychain.
|
|
87
|
+
|
|
88
|
+
### List
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
ldapc list users # all users
|
|
92
|
+
ldapc list groups # all groups
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Search
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ldapc search user john # users matching "john" (case-insensitive)
|
|
99
|
+
ldapc search group admin # groups matching "admin"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Get
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
ldapc get user jdoe # exact user lookup
|
|
106
|
+
ldapc get group devs # exact group lookup
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Add / Delete
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ldapc add user newuser
|
|
113
|
+
ldapc add group newgroup
|
|
114
|
+
ldapc delete user olduser
|
|
115
|
+
ldapc delete group oldgroup
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Group Membership
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
ldapc user add group jdoe developers # add user to group
|
|
122
|
+
ldapc user remove group jdoe developers # remove user from group
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Output Formats
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
ldapc list users --json # JSON output
|
|
129
|
+
ldapc list users --yaml # YAML output (simplified, human-friendly)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Global Flags
|
|
133
|
+
|
|
134
|
+
These flags can appear after any subcommand:
|
|
135
|
+
|
|
136
|
+
| Flag | Env Var | Description |
|
|
137
|
+
|------|---------|-------------|
|
|
138
|
+
| `--debug` | — | Enable debug logging to stderr |
|
|
139
|
+
| `--skip-ssl-verify` | `LDAPC_SKIP_SSL_VERIFY=1` | Skip TLS certificate verification |
|
|
140
|
+
| `--json` | — | Output as JSON |
|
|
141
|
+
| `--yaml` | — | Output as simplified YAML |
|
|
142
|
+
|
|
143
|
+
### Help
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
ldapc --help # top-level help
|
|
147
|
+
ldapc get --help # subcommand help
|
|
148
|
+
ldapc --version # show version
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Documentation
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
ldapc --docs # list available doc files
|
|
155
|
+
ldapc --docs README.md # render README as rich text
|
|
156
|
+
ldapc --docs README.md --page # render with paging
|
|
157
|
+
ldapc --docs README.md --markdown # output raw markdown
|
|
158
|
+
ldapc --docs docs/README.md --page # view docs/README.md with paging
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Running Tests
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pip install -e ".[dev]"
|
|
165
|
+
python3 -m pytest tests/ -v
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
With coverage:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 -m pytest tests/ --cov=ldapc --cov-report=term-missing
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CHANGELOG.md,sha256=OYKeeRfc8AYsFLXfoDu62BwXNbeQgNuK1RlgrT_IInM,2080
|
|
2
|
+
README.md,sha256=nbc8MTx30j9_2bE-URuofmpHyrmiEoYEHO9-hiMpSKc,3247
|
|
3
|
+
.kiro/specs/ldap-cli/design.md,sha256=koYsCnQvNuuEj5xgJSqFABkwPFxrEz0dcHkOjIkH-S8,13482
|
|
4
|
+
.kiro/specs/ldap-cli/requirements.md,sha256=xFScCYTZxif-2cYPPN1HIxzCrt8qu9gm1bGjTcH8NO4,7514
|
|
5
|
+
.kiro/specs/ldap-cli/tasks.md,sha256=Z9gBfveLGUQYd_LQUFQjRRrrFNidE8-Y5JKPlcDJYsU,13605
|
|
6
|
+
docs/reference.md,sha256=924U-gzlWNtfUHTIqftm8TVnnSwzlGXNUnZ2174qXjI,4492
|
|
7
|
+
ldapc/__init__.py,sha256=8ntPgJlmCUqN9NCmLQVud9Mdmn0REdE0JYmogK0ZYNw,154
|
|
8
|
+
ldapc/_version.py,sha256=mIgpETlDjKiEIAT1QDogOA_05_j0D8qmqQQ6V_WUlNg,648
|
|
9
|
+
ldapc/cli.py,sha256=Ti0iUsFi9fHsQaN9f2_SjDQ_sX-a3-jGKchjgMKddeE,15830
|
|
10
|
+
ldapc/config.py,sha256=pJo8VwTQcxL-Rb4-h9s87BfhUMYGRe4wPYnoab-lYUo,5126
|
|
11
|
+
ldapc/exceptions.py,sha256=i898J3IUMbWj9MMHhMnezVZneqeB_KPgNOrpZGDN7aQ,969
|
|
12
|
+
ldapc/formatter.py,sha256=YXbhrI0x0zQ7pcbm_cuPyrwsGL-VauyqcK27Y7N1D0c,7724
|
|
13
|
+
ldapc/ldap_client.py,sha256=FSQTEWSIWYSBcPJkHMSqdnZLVx3CWMhKRlgFtLOJDU4,18177
|
|
14
|
+
ldap_cli-0.2.0.dist-info/METADATA,sha256=ivLrjV6Basjoe2jkHjpBTsjI-4BrlBTIuezlW-_Gd9E,4434
|
|
15
|
+
ldap_cli-0.2.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
16
|
+
ldap_cli-0.2.0.dist-info/entry_points.txt,sha256=D6nHTNes2NRHTR0bA633sFT4HYbB1Ot3Roeg1WYRS0M,41
|
|
17
|
+
ldap_cli-0.2.0.dist-info/licenses/LICENSE,sha256=UMcMnj-XOQ0ZDOJqJrBnb-BjKOQjvm0CZcskx7k0_H8,1067
|
|
18
|
+
ldap_cli-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Topaz Bott
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ldapc/__init__.py
ADDED
ldapc/_version.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Version information for ldapc package."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_version() -> str:
|
|
9
|
+
"""Extract the latest version from CHANGELOG.md.
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
str: Version string from the first non-unreleased entry in CHANGELOG.md,
|
|
13
|
+
or 'unknown' if not found.
|
|
14
|
+
"""
|
|
15
|
+
changelog = os.path.join(os.path.dirname(__file__), '..', 'CHANGELOG.md')
|
|
16
|
+
with open(changelog, encoding='utf8') as f:
|
|
17
|
+
for line in f:
|
|
18
|
+
if line.startswith('## [') and 'unreleased' not in line.lower():
|
|
19
|
+
return line.split(']')[0].split('[')[1]
|
|
20
|
+
return 'unknown'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
__version__ = get_version()
|