Tutorial: Configure a domain with the internal user database and HTTP basic authentication
This tutorial covers another popular fine-grained access control use case: a master user in the internal user database and HTTP basic authentication for OpenSearch Dashboards.
To get started with fine-grained access control
-
Create a domain with the following settings:
-
OpenSearch 1.0 or later, or Elasticsearch 7.9 or later
-
Public access
-
Fine-grained access control with a master user in the internal user database (
TheMasterUserfor the rest of this tutorial) -
Amazon Cognito authentication for Dashboards disabled
-
The following access policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": [ "*" ] }, "Action": [ "es:ESHttp*" ], "Resource": "arn:aws:es:region:account:domain/domain-name/*" } ] } -
HTTPS required for all traffic to the domain
-
Node-to-node encryption
-
Encryption of data at rest
-
-
Navigate to OpenSearch Dashboards.
-
Sign in using
TheMasterUser. -
Choose Try our sample data.
-
Add the sample flight data.
-
Choose Security, Internal users, Create internal user.
-
Name the user
new-userand specify a password. Then choose Create. -
Choose Roles, Create role.
-
Name the role
new-role. -
For index permissions, specify
dashboards_sample_data_fli*for the index pattern. -
For the action group, choose read.
-
For Document level security, specify the following query:
{ "match": { "FlightDelay": true } } -
For field-level security, choose Exclude and specify
FlightNum. -
For Anonymization, specify
Dest. -
Choose Create.
-
Choose Mapped users, Manage mapping. Then add
new-userto Users and choose Map. -
Return to the list of roles and choose opensearch_dashboards_user. Choose Mapped users, Manage mapping. Then add
new-userto Users and choose Map. -
In a new, private browser window, navigate to Dashboards, sign in using
new-user, and then choose Explore on my own. -
Go to Dev Tools and run the default search:
GET _search { "query": { "match_all": {} } }Note the permissions error.
new-userdoesn't have permissions to run cluster-wide searches. -
Run another search:
GET dashboards_sample_data_flights/_search { "query": { "match_all": {} } }Note that all matching documents have a
FlightDelayfield oftrue, an anonymizedDestfield, and noFlightNumfield. -
In your original browser window, signed in as
TheMasterUser, choose Dev Tools and perform the same searches. Note the difference in permissions, number of hits, matching documents, and included fields.