Run through all of the test scenarios to validate the security plugin functionality
Configuration files
- Before starting the cluster, add a role to roles.yml and a tenant to tenants.yml.
- Start the cluster.
- Open Dashboards and log in.
- Security / Roles / Verify that the role exists.
- Tenants / Verify that the tenant exists.
Create users
- Open Dashboards and log in as admin.
- Security / Internal User Database / Add a new internal user.
- Provide a username and password.
- Provide a backend role and a user attribute. [No backend role]
- Submit.
- Verify that the user is created.
Create role
- Open Dashboards and log in as admin.
- If you haven’t added any data, add the sample flight data.
- Security / Roles / Add a new role.
- Cluster Permissions / Add Permissions: Action Groups / read., indices:data/read/search*
- Index Permissions / Add index permission / opensearch_dashboards_sample_data_flights*
- Add Add Permissions: Action Groups / read., indices:data/read/search*
- For Document Level Security Query, enter:
{"match": {"FlightDelay": true}}
- For Anonymize fields, enter: FlightNum
- Tenant Permissions / Add tenant permissions / Add tenant pattern / Specify the tenant that you created earlier
- Permissions / Add Field / kibana_all_read
- Save Role Definition.
- Verify that the role is created.
Map Role
- Open Dashboards and log in as admin.
- Security / Role Mappings / kibana_user
- Add User / Specify the user you created earlier / Submit
- Add a new role mapping / Choose the role you created earlier
- Add User / Specify the user you created earlier / Submit.
Create Index Pattern
- Change the tenant of the admin to newly created tenant
- Add the index pattern by clicking discover tab
- Discover / Add an index pattern: opensearch_dashboards_sample_data_flights
- Next step / timestamp / Create index pattern
- Move to Dashboards Basics to verify that the mappings worked and the roles are working as expected.
Dashboards Basics
- Open Dashboards in an Incognito window and log in as the user you created earlier.
- Explore on my own
- DevTools:
GET kibana_sample_data_flights/_search
{
"query": {
"match_all": {}
}
}
- Verify that you have fewer than 10,000 hits. When I wrote this, I had 3,280 hits, all of which had “FlightDelay”: true (expected).
- Verify that FlightNum is anonymized.
Multi-tenancy
- Create Dashboard with admin and new tenant.
- Check if new Dashboard is visible to the new user
Running with dev-tool requests
For creating tenant, user, role and role mapping
PUT _plugins/_security/api/tenants/security-test-tenant
{
"description": "A tenant for security testing."
}
PUT _plugins/_security/api/internalusers/test-01
{
"password": "abcd1234"
}
PUT _plugins/_security/api/roles/security-test-role
{
"cluster_permissions" : [
"read"
],
"index_permissions" : [
{
"index_patterns" : [
"opensearch_dashboards_sample_data_flights*"
],
"dls" : """ {"match": {"FlightDelay": true}}""",
"fls" : [ ],
"masked_fields" : [
"FlightNum"
],
"allowed_actions" : [
"read"
]
}
],
"tenant_permissions" : [
{
"tenant_patterns" : [
"security-test-tenant"
],
"allowed_actions" : [
"kibana_all_read"
]
}
]
}
PUT _plugins/_security/api/rolesmapping/security-test-role
{
"users" : [ "test-01" ]
}
Run through all of the test scenarios to validate the security plugin functionality
Configuration files
Create users
Create role
{"match": {"FlightDelay": true}}Map Role
Create Index Pattern
Dashboards Basics
Multi-tenancy
Running with dev-tool requests
For creating tenant, user, role and role mapping