Skip to content

gustavo4passos/ezl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezl - Easy Ldap

ezl is a CLI tool, written in Go that makes it easy to manage users and groups in systems using LDAP to handle user management and authentication.

1 Usage

ezl [command] ...

Commands:
    user  - Manage users
    group - Manage groups

1.1 The user Command

The user command can be used to create, remove and modify users.

Usage: ezl user <command> ...

Commands:
  add     - Add a new user
  remove  - Remove an existing user
  change  - Change the attributes of an existing user
  set_pwd - Set the password for an existing user

user add Command

The user add command can be used to create new users. If the uid parameter it's omitted, it will be chosen automatically: ezl will find the user with highest uid in the system, and will choose the next number. It will also automatically create a user group with the same name as username.

Usage: ezl user add <username> [-name name] [-surname surname] [-pwd password] [-uid user_id] [-mail email]

Examples:

# Since uid is omitted
ezl add user john.doe -name John -surname Doe

user remove Command

The user remove command will remove an existing user from the system.

Usage: ezl user remove <username>

Examples:

ezl user remove john.doe

user change Command

The user change command can be used to change user attributes after creation.

Usage: ezl user change <username> [-name name] [-surname surname] [-shell loginShell] [-mail mail] [-home homeDirectory]

Examples:

ezl user change john.doe -name John2 -surname Doe2 -shell /bin/sh -mail john.doe2@mail.com -home "/newhome/joh.doe.2"

user set_pwd Command

The user set_pwd command can be used to change the password for a user. It will interactively prompt (no echo) for the password after being invoked.

Usage: ezl user set_pwd <username>

Examples:

ezl user set_pwd john.doe

1.2 The group Command

The group command can be used to add and remove groups, as well as adding and removing user from groups.

Usage: ezl group [command] ...

Commands:
  add         - Add a new group
  remove      - Remove an existing group
  add_user    - Add a user to an existing group
  remove_user - Remove user from an existing group

The group add Command

The group add command will create a new group in the system. If gid is omitted, ezl will find the highest gid in the system, and automatically choose the next number for the group.

Usage: ezl group add <groupname> [-gid group_id]

Examples:

# Add group with automatic gid
ezl group add mygroup
# Add group with a specific gid
ezl group add mygroup -gid 9999

The group remove Command

group remove will remove a group from the sytem.

Usage: ezl group remove <groupname>

Examples:

ezl group remove mygroup

The group add_user Command

The command group add_ser can be used to add an existing user to a group.

Usage: ezl group add_user <groupname> <user_name>

Examples

ezl group add_user mygroup john.doe

The group remove_user Command

The command group add_ser can be used to remove an existing user to a group.

Usage: ezl group remove_user <groupname> <user_name>

Examples

ezl group remove_user mygroup john.doe

2 Configuration File

ezl will look for the file /etc/ezl/config.json to retrieve important configuration parameters. The file needs to have the following fields:

  • ldapUri - (Mandatory) The URI that will be used to connect to LDAP
  • baseDN - (Mandatory) The root DN that will be used for searches and modifications
  • bindDN - (Mandatory) The DN that will be used for LDAP binding
  • userHomePath - The default home path that will be set for new users (Default: /home/). This directory won't be created, it will only be set in the user entry.
  • loginShell - The default home shell that will set for new users (Default: /bin/bash)

Example configuration:

{
  "baseDN": "dc=my,dc=ldapserver,dc=com",
  "bindDN": "cn=Manager,dc=my,dc=ldapserver,dc=com",
  "userHomePath": "/home/",
  "loginShell": "/bin/bash",
  "ldapUri": "ldap://localhost:389"
}

3 Building the Source Code

The CLI tool can be built by running

go build ./ezl/cmd

About

A CLI tool to simplify user and group management in LDAP systems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages