- Lab
- A Cloud Guru
Configure User Access Control for Elasticsearch
To enforce data confidentiality and maintain user accessibility with Elasticsearch, we need to know how to create custom roles and users. In this hands-on lab, we go through the following tasks on a single-node Elasticsearch cluster, using either Kibana or `curl` on the command line: * Create custom roles * Create users
Path Info
Table of Contents
-
Challenge
Create the sample_read Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_read { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_read?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read"]}]}'
-
Challenge
Create the sample_write Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_write { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read", "write" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_write?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","write"]}]}'
-
Challenge
Create the sample_monitor Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_monitor { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read", "monitor" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_monitor?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","monitor"]}]}'
-
Challenge
Create the john User
Use the Kibana console tool to execute the following:
POST _security/user/john { "roles": [ "kibana_user", "sample_read" ], "full_name": "John Doe", "email": "[email protected]", "password": "john_123" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/john?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_read"],"full_name":"John Doe","email":"[email protected]","password":"john_123"}'
-
Challenge
Create the jane User
Use the Kibana console tool to execute the following:
POST _security/user/jane { "roles": [ "kibana_user", "sample_write" ], "full_name": "Jane Doe", "email": "[email protected]", "password": "jane_456" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/jane?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_write"],"full_name":"Jane Doe","email":"[email protected]","password":"jane_456"}'
-
Challenge
Create the noc User
Use the Kibana console tool to execute the following:
POST _security/user/noc { "roles": [ "kibana_user", "sample_monitor", "monitoring_user" ], "full_name": "Network Operations Center", "email": "[email protected]", "password": "noc_789" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/noc?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_monitor","monitoring_user"],"full_name":"Network Operations Center","email":"[email protected]","password":"noc_789"}'
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.