Multi-tenancy configuration

Multi-tenancy is enabled by default, but you can disable it or change its settings using config/opensearch-security/config.yml:

  1. config:
  2. dynamic:
  3. kibana:
  4. multitenancy_enabled: true
  5. private_tenant_enabled: true
  6. default_tenant: global tenant
  7. server_username: kibanaserver
  8. index: '.kibana'
  9. do_not_fail_on_forbidden: false
SettingDescription
multitenancy_enabledEnable or disable multi-tenancy. Default is true.
private_tenant_enabledEnable or disable the private tenant. Default is true.
default_tenantUse to set the tenant that is available when users log in.
server_usernameMust match the name of the OpenSearch Dashboards server user from opensearch_dashboards.yml. Default is kibanaserver.
indexMust match the name of the OpenSearch Dashboards index from opensearch_dashboards.yml. Default is .kibana.
do_not_fail_on_forbiddenWhen true, the Security plugin removes any content that a user is not allowed to see from the search results. When false, the plugin returns a security exception. Default is false.

The opensearch_dashboards.yml file includes additional settings:

  1. opensearch.username: kibanaserver
  2. opensearch.password: kibanaserver
  3. opensearch.requestHeadersAllowlist: ["securitytenant","Authorization"]
  4. opensearch_security.multitenancy.enabled: true
  5. opensearch_security.multitenancy.tenants.enable_global: true
  6. opensearch_security.multitenancy.tenants.enable_private: true
  7. opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"]
  8. opensearch_security.multitenancy.enable_filter: false
SettingDescription
opensearch.requestHeadersAllowlistOpenSearch Dashboards requires that you add all HTTP headers to the allow list so that the headers pass to OpenSearch. Multi-tenancy uses a specific header, securitytenant, that must be present with the standard Authorization header. If the securitytenant header is not on the allow list, OpenSearch Dashboards starts with a red status.
opensearch_security.multitenancy.enabledEnables or disables multi-tenancy in OpenSearch Dashboards. Default is true.
opensearch_security.multitenancy.tenants.enable_globalEnables or disables the global tenant. Default is true.
opensearch_security.multitenancy.tenants.enable_privateEnables or disables private tenants. Default is true.
opensearch_security.multitenancy.tenants.preferredLets you change ordering in the Tenants tab of OpenSearch Dashboards. By default, the list starts with Global and Private (if enabled) and then proceeds alphabetically. You can add tenants here to move them to the top of the list.
opensearch_security.multitenancy.enable_filterIf you have many tenants, you can add a search bar to the top of the list. Default is false.

Add tenants

To create tenants, use OpenSearch Dashboards, the REST API, or tenants.yml.

OpenSearch Dashboards

  1. Open OpenSearch Dashboards.
  2. Choose Security, Tenants, and Create tenant.
  3. Give the tenant a name and description.
  4. Choose Create.

REST API

See Create tenant.

tenants.yml

  1. ---
  2. _meta:
  3. type: "tenants"
  4. config_version: 2
  5. ## Demo tenants
  6. admin_tenant:
  7. reserved: false
  8. description: "Demo tenant for admin user"

Give roles access to tenants

After creating a tenant, give a role access to it using OpenSearch Dashboards, the REST API, or roles.yml.

  • Read-write (kibana_all_write) permissions let the role view and modify objects in the tenant.
  • Read-only (kibana_all_read) permissions let the role view objects, but not modify them.

OpenSearch Dashboards

  1. Open OpenSearch Dashboards.
  2. Choose Security, Roles, and a role.
  3. For Tenant permissions, add tenants, press Enter, and give the role read and/or write permissions to it.

REST API

See Create role.

roles.yml

  1. ---
  2. test-role:
  3. reserved: false
  4. hidden: false
  5. cluster_permissions:
  6. - "cluster_composite_ops"
  7. - "indices_monitor"
  8. index_permissions:
  9. - index_patterns:
  10. - "movies*"
  11. dls: ""
  12. fls: []
  13. masked_fields: []
  14. allowed_actions:
  15. - "read"
  16. tenant_permissions:
  17. - tenant_patterns:
  18. - "human_resources"
  19. allowed_actions:
  20. - "kibana_all_read"
  21. static: false
  22. _meta:
  23. type: "roles"
  24. config_version: 2

Manage OpenSearch Dashboards indices

The open source version of OpenSearch Dashboards saves all objects to a single index: .kibana. The Security plugin uses this index for the global tenant, but separate indices for every other tenant. Each user also has a private tenant, so you might see a large number of indices that follow two patterns:

  1. .kibana_<hash>_<tenant_name>
  2. .kibana_<hash>_<username>

The Security plugin scrubs these index names of special characters, so they might not be a perfect match of tenant names and usernames.

To back up your OpenSearch Dashboards data, take a snapshot of all tenant indexes using an index pattern such as .kibana*.