python active directory cli using python-ldap lib to manage ad servers
Project description
p_ad
lab using python-ldap lib to create connection with Active Directory
Setup
python -m venv env && source env/bin/activate && pip install -e .
Create .env file inside root directory to establish a ldap connection
.env
URI='ldap://192.168.0.213'
BIND_DN='administrator@rts.local'
AUTH_PASS='Mypasswd@123'
CA_PATH=''
BASE_DN='DC=RTS,DC=LOCAL'
Running
p_ad has a cli written in Typer to manipulate operations in AD
./env/bin/padc --help
users
is the main subcommand, every subcommand has a helper option
./env/bin/pacd users --help
padc
has in users subcommand some basic operations
if one of the supported operations run with --debug
option
when errors occurs the traceback and exception will be raised.
exp:
./env/bin/padc users create -f .env "Pingu pythonico" "Pingupassword@123" -c 514 --debug
./env/bin/padc users create-ldif -f .env --ldif example.ldif
./env/bin/padc users add-to-group --file .env "Pingu" "CN=testgroup,CN=Users,DC=RTS,DC=LOCAL" --debug
./env/bin/padc users remove-from-group --file .env "Pingu" "CN=testgroup,CN=Users,DC=RTS,DC=LOCAL"
./env/bin/padc users delete --file .env "Pingu pythonico"
./env/bin/padc users enable -f .env "Pingu" --debug
./env/bin/padc users disable "Pingu" --debug
Testing
Simple Unittest to create/delete/modify user account in AD
python -m unittest -v tests.test_msad
Building
Ensure that you have build package installed first
pip install --upgrade build
python -m build
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 Distribution
Built Distribution
File details
Details for the file padc-0.2.tar.gz
.
File metadata
- Download URL: padc-0.2.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7287ed049f17517488196c34366735d6f5f25c90edf18eda88d37ad1d9eba0d4
|
|
MD5 |
abf2619dd8c40649ac7bb384cb157a74
|
|
BLAKE2b-256 |
1102b2c9e0ea02d1c4cf4ccae5fbb900777806b7a51681781f2e8b927826d58c
|
File details
Details for the file padc-0.2-py3-none-any.whl
.
File metadata
- Download URL: padc-0.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0ec2606d7c7dfecb93b3534a8b0e870a770c56e2036cd2988832b13244335b06
|
|
MD5 |
46caf63a86c5cc54069803d586d5c22c
|
|
BLAKE2b-256 |
f0f08a6a21fde3fcb25c807d26ed6f8b83a4833662abdfe3f5cc6016e915167b
|