Elastic Stack security comes with default users and a built-in credential helper to set up security with ease and have things up and running quickly. Open up another Terminal and navigate to ES_HOME. Let's generate the passwords for the reserved/default users—elastic, kibana, apm_system, remote_monitoring_user, beats_system, and logstash_system—by executing the following command:
$ ES_HOME>bin/elasticsearch-setup-passwords interactive
You should get the following logs/prompts to enter the password for the reserved/default users:
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:elastic
Reenter password for [elastic]:elastic
Enter password for [apm_system]:apm_system
Reenter password for [apm_system]:apm_system
Enter password for [kibana]:kibana
Reenter password for [kibana]:kibana
Enter password for [logstash_system]:logstash_system
Reenter password for [logstash_system]:logstash_system
Enter password for [beats_system]:beats_system
Reenter password for [beats_system]:beats_system
Enter password for [remote_monitoring_user]:remote_monitoring_user
Reenter password for [remote_monitoring_user]:remote_monitoring_user
Changed password for user [apm_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
To verify X-Pack's installation and enforcement of security, point your web browser to http://localhost:9200/ to open Elasticsearch. You should be prompted to log in to Elasticsearch. To log in, you can use the built-in elastic user and elastic password. Upon logging in, you should see the following response:
{
"name" : "MADSH01-APM01",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "I2RVLSk2Rr6IRJb6zDf19g",
"version" : {
"number" : "7.0.0",
"build_flavor" : "default",
"build_type" : "zip",
"build_hash" : "b7e28a7",
"build_date" : "2019-04-05T22:55:32.697037Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Before we can go ahead and start Kibana, we need to set the Elasticsearch credentials in kibana.yml so that when we boot up Kibana, it knows what credentials it needs to use for authenticating itself/communicating with Elasticsearch.
Add the following credentials in the kibana.yml file, which can be found under $KIBANA_HOME/config, and save it:
elasticsearch.username: "kibana"
elasticsearch.password: "kibana"
Start Kibana:
$KIBANA_HOME>bin/kibana
To verify that the authentication is in place, go to http://localhost:5601/ to open Kibana. You should be prompted to login to Kibana. To log in, you can use the built-in elastic user and the elastic password, as follows: