Wazuh Server LDAP/ActiveDirectory Authentication

Official guide: https://documentation.wazuh.com/current/user-manual/user-administration/ldap.html

As I was using LDAPS, first step was to copy the Domain Controller SSL Certs or your Local CA cert to the following. As I have two domain controllers with self-signed certs, so I copied them both to single file: /etc/wazuh-indexer/opensearch-security/ldapcacert.pem

vi /etc/wazuh-indexer/opensearch-security/config.yml

The second section to change is for authorization. Official guide is missing ldapscert file path for ldaps.

Run the securityadmin script to load the configuration changes made in the config.yml file

Setup administrator role

Follow these steps to create a new role mapping and grant administrator permissions to the backend role.

  1. Configure the roles_mapping.yml file to map the role (CN) we have in our LDAP server to the appropriate Wazuh indexer role. In our case, we map users in the Administrator group in LDAP to the all_access role on Wazuh indexer.

    Edit the /etc/wazuh-indexer/opensearch-security/roles_mapping.yml file and change the following values:

    I added “adm_wazuh” which also exists in my AD/LDAP

2. Run the securityadmin script to load the configuration changes made in the roles_mapping.yml file:

3. Check the value of run_as in the /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml configuration file. If run_as is set to false, proceed to the next step

You can possibly skip the next section. If run_as is set to true, you need to add a role mapping on the Wazuh dashboard. To map the backend role to Wazuh, follow these steps:

a. Click  to open the menu on the Wazuh dashboard, go to Server management > Security, and then Roles mapping to open the page.

Roles mapping selection

b. Click Create Role mapping and complete the empty fields with the following parameters:

  • Role mapping name: Assign a name to the role mapping.
  • Roles: Select administrator.
  • Custom rules: Click Add new rule to expand this field.
  • User fieldbackend_roles.
  • Search operationFIND.
  • Value: Assign the name of your backend role in your LDAP server. In our case, this is a group named Administrator which contains users with administrator roles

c. Scroll down and Click Save role mapping to save and map the backend role with Wazuh as administrator.

4. Restart the Wazuh dashboard service using this command:

You can also create read-only role mapping, please consult official guide for more info.

The following warning is displays if run_as is setup to false. It must be true to use mapping in web-gui.

For the role mapping to take effect, enable run_as in the API host configuration, restart the dashboard service and clear your browser cache and cookies.

vi /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml

Change run_as from false to true:

run_as: true ##false

Restart Wazuh Services:

systemctl restart wazuh-manager
systemctl restart wazuh-dashboard

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *