Hi @Subgenius,
Thanks for taking the time to describe your target setup.
For Q1, No, not directly. OpenSearch Security authenticates the user first and retrieves AD groups afterwards for authorization.If you want to restrict which users can authenticate, you should configure the LDAP authentication (authc) domain in config/opensearch-security/config.ymlby narrowing the userbase and, if needed, the usersearch filter.
Relevant config.yml fields:
usersearch: '(sAMAccountName={0})'
userbase: 'ou=people,dc=example,dc=com'
The relevant documentation is here:
https://docs.opensearch.org/latest/security/authentication-backends/ldap/#use-active-directory-and-ldap-for-authentication
For Q2, yes, your understanding is generally correct. After authentication succeeds, the LDAP authorization (authz) configuration is used to resolve the authenticated user’s LDAP/AD group memberships. In OpenSearch Security, those groups can then be used as backend roles and mapped to OpenSearch roles through role mappings.
For Q3, regarding “Is the code just looking for an AD group name that matches a role name?” No, OpenSearch Security does not automatically grant permissions by looking for an OpenSearch role with the same name as the AD group.
The LDAP/AD groups returned during authorization are typically used as backend roles. Those backend roles are then mapped to OpenSearch roles through role mappings, for example using the Security UI, the REST API, or roles_mapping.yml. The mapping is configured explicitly rather than relying on an OpenSearch role with the same name as the AD group.
For example, if LDAP resolves the AD group Dept1_os_users, you could create a role mapping for the OpenSearch role dept1_role in roles_mapping.yml:
dept1_role:
reserved: false
backend_roles:
- "Dept1_os_users"
users: []
hosts: []
The permissions are then configured on the OpenSearch role dept1_role, not directly on the AD group name.
For Q4, yes,the model you described is reasonable.The department group should not receive tenant access directly. Instead, the usual flow would be:
AD group: Dept1_os_users
backend role: Dept1_os_users
OpenSearch role: dept1_role
tenant permissions: Dept1 tenant
So dept1_role would contain the permissions for the Dept1 tenant, and the AD group/backend role Dept1_os_users would be mapped to dept1_role through role mappings.
The relevant documentation is split across a few areas rather than one single end-to-end example:
LDAP auth/authz: https://docs.opensearch.org/latest/security/authentication-backends/ldap
Role mappings: https://docs.opensearch.org/latest/security/access-control/users-roles
Multi-tenancy/tenant permissions: https://docs.opensearch.org/latest/security/multi-tenancy/multi-tenancy-config
If you run into any issues while setting this up, feel free to share the relevant OpenSearch Security configuration (with any sensitive information redacted), and I’d be happy to review it.