collection of bash scripts to manage ldap users and groups

theo 62ec237854 Fix typo in readme 1 년 전
.env.example 969dab983a Add TLS support 1 년 전
.gitignore 8e2484f980 Initial commit 2 년 전
LICENSE 3c0e6db2d6 typo 2 년 전
README.md 62ec237854 Fix typo in readme 1 년 전
addmailalias bdbab89267 Added `addmailalias` command 1 년 전
addtogroups d4d0c6f77c Fixed addtogroups not adding users to posix groups 2 년 전
creategroup 0b51f131f3 Fix grammar 2 년 전
createperson aea06984ae Changed password generation to a random password and switched to SHA512 so people don't risk getting winched 1 년 전
funcs 969dab983a Add TLS support 1 년 전
person2posix 21b40d860f Fixed typo 2 년 전
removefromgroups 0c49211a13 Fixed removefromgroups not removing users from posix groups 2 년 전
removeperson c4987c82d3 Added -y flag to removeperson to bypass confirmation 2 년 전

README.md

Configuration :

Copy the configuration file :

cp .env.example .env

Then, edit .env and set the correct values

Dependencies

  • A working LDAP server
  • slappasswd
  • pwgen
  • ldap{search, modify, delete, add}

Usage

  • createperson

Create an account, with the following parameters :

-u <uid> : the new user's uid
-n <first name> : the new user's first name
-s <last name> : the new user's uid
-p (optional) : give the user the `posixAccount` object class, and the necessary attributes. 
This is necessary if the user needs to be added to posix Groups
-g <group1[,group2,group3,...]> : add the user the to one or more groups 
(separated by commas when more than one group is given)
  • removeperson

Removes a user from the directory, including the corresponding posixGroup if the user is a posixAccount. The -y option can be given as the first argument to bypass the confirmation prompt

./removeperson [-y] uid
  • creategroup

Since adding the first user needs to be done at the creation of the group, a valid uid needs to be passed to the script.

The optional -p option can be given as the first argument. It indicates that the group to be created is a posixGroup. Therefore, the user also needs to be a posixAccount.

./creategroup [-p] uid group
  • addtogroups and removefromgroups

Add or remove an user to/from one or more groups. User's uid must be the first argument. Posix and non-posix groups can be given, but if posixGroups are given, the user needs to be a posixAccount.

./addtogroups uid group1 [group2, group3,  ...]
./removefromgroups uid group1 [group2, group3,  ...]
  • person2posix

Give the user the posixAccount object class, and the necessary attributes, and create a posixGroup with the same uid and number as the user.

./person2posix uid
  • addmailalias

Add a new mail alias for a user. User needs to be in the mail group

./addmailalias uid alias@example.com