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
padc-0.2.tar.gz
(8.8 kB
view hashes)
Built Distribution
padc-0.2-py3-none-any.whl
(9.3 kB
view hashes)