Hello batsal!
If I understand you correctly, what you want is that depending on the tenant with which a user connects, he/she has restricted (or no) access to the Kibana WUI (and from here to the Wazuh API), rigth?
With RBAC you can restrict access to the Wazuh API as needed. You can use a single Wazuh manager if you wish, saving resources and you can also use several different managers with their corresponding RBAC. Before enabling RBAC be sure to create a user with sufficient permissions to be able to manage the other RBAC resources you will need in the future once you have it enabled.
To enable RBAC you only need to set the run_as setting to true in the /usr/share/kibana/data/wazuh/config/wazuh.yml file for each Wazuh API you have set. Example:
. . .
hosts:
- WazuhA:
port: 55000
username: wazuh-wui
password: <wazuh_api_password>
run_as: true
- WazuhB:
port: 55000
username: wazuh-wui
password: <wazuh_api_password>
run_as: true
. . .
Now that you have RBAC enabled in your WUI you can restrict access to users based on their tenant. To do this, we will use the Authorization Context of each user accessing Kibana. Let's see an example of AC:
{ authContext:
{ user_name: 'userB',
is_reserved: false,
is_hidden: false,
is_internal_user: true,
user_requested_tenant: '__user__',
backend_roles: [ 'kibanauser', 'readall' ],
custom_attribute_names:
[ 'attr.internal.attribute1',
'attr.internal.attribute2',
'attr.internal.attribute3' ],
tenants: { tenantA: false, tenantB: true },
roles: [ 'kibana_user', 'own_index', 'readall' ] } }
In this case, as you want to restrict access by tenants I propose the following option:
1. Go to the Security section in Wazuh Wui. Select Roles mapping subsection. Create new Role mapping
2. Give a distinctive name to the Role mapping you are going to create.
3. Set the role you want for users who have this mapping. Remember that you can create additional roles.
4. Create the mapping you need according to the tenant assigned to the user.
5. Save Role Mapping.
In this example, we have created a Role mapping that will be applied to all users that have the Tenant tenantB set to true, which will have the role of readonly for the selected Wazuh manager API and will only be able to read/view the resources of that manager (because only that manager contains this mapping) trough WUI. If you have more managers and want to manage their access in different ways you will have to create mappings for each of them.
Thinking about your environment, you may want to have a single manager and have several rules based on all your tenants or have several managers with rules only for the tenants that need to access your resources.
RBAC is a complex thing to understand, I hope I have been helpful. Please do not hesitate to contact us with any questions you may have.
Best regards,
Alfonso Ruiz-Bravo