Skip to main content

LDAP User Script Toolkit

A collection of python scripts that act as a wrapper/cli for the python-ldap library. There is an overall config file config.yml. The scripts have the following functionalities:

  • add/delete LDAP accounts,
  • create/archive user directories (and set quotas) belonging to these accounts on all fileservers according to the settings in the config.yml,
  • change email addresses in LDAP, GitLab and mailing list subscriptions
  • reset passwords
  • create/remove groups in ldap
  • add/remove users from LDAP groups

All scripts provide --help, --verbose and --dryrun flags.

Install

pip install ldapKIT

User add/delete

To add/delete users, you can use the scripts: particleldapuseradd and particleldapuserdel -–user NAME.
There is also the functionality to search for users that are inactive for n days (inactive means: last password change older than m days) and delete them with particleldapuserdel –-cleanup.
The userdel script does not only remove the ldap user but is also able to run post-deletion tasks via ansible e.g. to backup user directories.

Group add/delete/modify

This is done via the tool particleldapgroup. Usage:

# particleldapgroup --help
usage: particleldapgroup [-h] [--verbose] [--dryrun]
                         {create,delete,adduser,deluser,cleanup} ...

positional arguments:
  {create,delete,adduser,deluser,cleanup}
    create              create new group
    delete              delete group
    adduser             add users to group
    deluser             remove users from group
    cleanup             remove non-existant users from group

optional arguments:
  -h, --help            show this help message and exit
  --verbose, -v         add more ouput
  --dryrun, -d          don't write anything

Changing E-Mail Addresses

There is the script particleldapchangeemail which changes the email of an user in its:

  • LDAP account,
  • GitLab account (which somehow does not update its database when an ldap account changes its email)
  • and removes/adds its old/new email to a configured mailing list.

Example configuration

See the config.yml for an example configuration which uses the full functionality. Also see the userdir.yml which is an ansible playbook invoked by particleldapuser{add,del} to create/archive user dirs on foregin file servers (set in the config.yml).

Metadata

Release files for ldapKIT 1.4.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldapKIT 1.4.10
File Size Uploaded
ldapkit-1.4.10.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ldapKIT 1.4.10
File Interpreter ABI Platform
ldapkit-1.4.10-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 32.1 kB

Release files / ldapkit-1.4.10.tar.gz

Download URL ldapkit-1.4.10.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
117054e708b0a99cf63124fed70e9a4f8645ec584c604f4ef6495518b068a50a
BLAKE2b-256 checksum
How to use checksums
a2d41f767301546f929b50526d62136b1c0147b446e390298c41009d3256c7e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / ldapkit-1.4.10-py2.py3-none-any.whl

Download URL ldapkit-1.4.10-py2.py3-none-any.whl
Size 17.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
38a49592d8496779f2afadca1f7fcf148209a4b69f42854d691a9d9e3aae248b
BLAKE2b-256 checksum
How to use checksums
07222c460b3d98a483764fb893f6ffe13327bb95cf29eb130467f7f502492ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

1.4.10 This release

2 release files

1.4.9

2 release files

1.4.8

2 release files

1.4.7

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.2

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page