Skip to Content

Is it possible to manage Ezeelogin users via API?

Managing users in Ezeelogin via API


Overview: This article explains how to manage Ezeelogin users through API.


It is not possible to create or remove Ezeelogin users with the API feature since there are a lot of risk factors associated with it. 
We recommend LDAP or Active Directory as the best way for user management.
User suspension, unsuspension, and force password change can be performed with the API feature.
Logs for all user-related API actions can be accessed through the Ezeelogin GUI.

To use the API feature, login to the Ezeelogin GUI, navigate to Settings → API, and set a new API secret and Save it.

The API script can be executed as:

root@gateway:~# php /usr/local/ezlogin/ezwapi.php [params...]

For Help 

root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help

Usage:

ezwapi.php -help <action>
action : API action (list_servers/add_server/update_server/remove_server/reset_fingerprint/add_user_server_acl/suspend_user/unsuspend_user/force_user_password_change/set_user_expiry)

NOTE: 'set_user_expiry' will also make the user active if suspended

1. Suspend User

root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help suspend_user

Usage:

ezwapi.php suspend_user -api_url <API URL> -secret <API secret> -user <username>

Example:

root@gateway:~# php /usr/local/ezlogin/ezwapi.php suspend_user -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john

2. Unsuspend User

root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help unsuspend_user
Usage:

ezwapi.php unsuspend_user -api_url <API URL> -secret <API secret> -user <username>

Example:

root@gateway:~# php /usr/local/ezlogin/ezwapi.php unsuspend_user -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john

3. Force password change

root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help force_user_password_change
Usage:

ezwapi.php force_user_password_change -api_url <API URL> -secret <API secret> -user <username>

Example:

root@gateway:~# php /usr/local/ezlogin/ezwapi.php force_user_password_change -api_url http://192.168.1.9/ezlogin -secret zxcvbnm -user john

This feature is only available from Ezeelogin version 7.32.0

4. Set user expiry

root@gateway:~# php /usr/local/ezlogin/ezwapi.php -help set_user_expiry

Usage:

ezwapi.php set_user_expiry -api_url <API URL> -secret <API secret> -user <username> -expiry <YYYY-MM-DD>

Refer to the example below to set expiry for user ’John’. Setting expiry will also make the user active if suspended.

root@gateway:~# php /usr/local/ezlogin/ezwapi.php set_user_expiry -api_url http://192.168.1.38/ezlogin -secret 'zjdfji@#$!' -user john -expiry "2025-01-30"
200: {"status":"success","data":"Success"}

If the user is already suspended the above API script will unsuspend the user and will set the new expiry date.

Setting user expiry via API is only available from Ezeelogin version 7.40.0


How can we view API logs?

Step 1(A): To view all the actions performed  via API navigate to Users  Web Activity  Who and select API. This will display a list of logs for all the actions executed through API.

Step 1(B): From the drop-down menu for the Section, select "Users" which will display the list of logs for all the user actions performed via API.

This feature to list the logs for the actions performed via API is available from Ezeelogin version 7.40.0


Related Articles:

Add / update / delete servers through Ezeelogin API

Add server with private key stored in database with API