Skip to content

Fabiokleis/padc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

padc

cli using python-ldap lib to create connections with Active Directory this project use poetry

Setup for development

create virtual environment

python -m venv .venv

activate environment

poetry shell 

install padc

poetry install

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'

padc has logging_settings.ini inside padc/config

[loggers]
keys = root

[handlers]
keys = FileHandler,StreamHandler

[formatters]
keys = simpleFormatter

[logger_root]
level = DEBUG
handlers = FileHandler,StreamHandler

[handler_FileHandler]
class     = FileHandler
formatter = simpleFormatter
args      = ('padc.log', 'a')

[handler_StreamHandler]
class     = StreamHandler
formatter = simpleFormatter
args      = (sys.stdout,)

[formatter_simpleFormatter]
format = %(asctime)s:%(levelname)s: %(message)s

Install padc from pypi

pip install padc

You can modify where log file will be created by editing logging_settings.ini the default file is created at current directory with name 'padc.log'

Running

cli written in Typer to manipulate operations in AD

padc --help

users is the main subcommand, every subcommand has a helper option

pacd users --help

padc has in users subcommand some basic operations if one of the supported operations runs with --debug option so when errors occurs the traceback and exception will be raised.

exp:

padc users create -f .env "Pingu pythonico" "Pingupassword@123" -c 514 --debug
padc users create-ldif -f .env --ldif example.ldif
padc users add-to-group --file .env "Pingu" "CN=testgroup,CN=Users,DC=RTS,DC=LOCAL" --debug
padc users remove-from-group --file .env "Pingu" "CN=testgroup,CN=Users,DC=RTS,DC=LOCAL"
padc users delete --file .env "Pingu pythonico"
padc users enable -f .env "Pingu" --debug
padc users disable "Pingu" --debug

Testing

Simple Unittest to create/delete/modify user account in AD

python -m unittest -v tests.test_msad

Building

poetry build

About

cli using typer and python-ldap lib to create connections with Active Directory to manage users

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy