# How to establish secured connection to elasticsearch

**URL:** https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783
**Category:** Kibana
**Created:** [February 11, 2019, 2:17am UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783 "2019-02-11T02:17:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)
#### Post date: [February 11, 2019, 2:18am UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/1 "2019-02-11T02:18:00Z")

</div>

I am following the instructions on the "Getting Started with Elasticsearch" video, in which the Kibana connects to Elasticsearch with no security enabled.  
But if Elasticsearch enabled security features, how to connect to it? Maybe use user account and password.

---

<div class="post-metadata">

### Author: ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)
#### Post date: [February 11, 2019, 11:25pm UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/2 "2019-02-11T23:25:19Z")

</div>

If you're using a recent version, and a trial license, you'll need to opt in to security to enable it. To do so, add `xpack.security.enabled: true` to your `elasticsearch.yml` file.

Once you do, you'll need to set the password for the user it connects as in the elasticsearch keystore and then tell Kibana that information. Our docs spend a lot of time talking about TLS and not a lot of time about [the keystore](https://www.elastic.co/guide/en/elasticsearch/reference/current/secure-settings.html). The gist is that you'll need to set the `bootstrap.password` value, like so:

```auto
./bin/elasticsearch-keystore add "bootstrap.password"

```

If you get an error that the value already exists, you can `remove` and then `add` it back. There might be a way to update it, but I don't know what that is, and removing and adding it back I know works.

The username is `elastic`, and assuming you set your password to `changeme`, you'll then need to add the following to your `kibana.yml` file:

```auto
elasticsearch.username: "elastic"
elasticsearch.password: "changeme"

```

Swap whatever value you actually set it to in place of `changeme` there.

---

<div class="post-metadata">

### Author: ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)
#### Post date: [February 12, 2019, 1:39am UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/3 "2019-02-12T01:39:37Z")

</div>

Why the username is not "kibana"?

---

<div class="post-metadata">

### Author: ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)
#### Post date: [February 13, 2019, 8:40pm UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/4 "2019-02-13T20:40:01Z")

</div>

It's been "elastic" for a very long time, but I don't know specifically why that username was picked.

It may be possible to change that, but I don't know offhand how to do that.

---

<div class="post-metadata">

### Author: ![li\_jessen2016](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/li_jessen2016/32/38817_2.png) [@li\_jessen2016](https://discuss.elastic.co/u/li_jessen2016)
#### Post date: [February 16, 2019, 7:39am UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/5 "2019-02-16T07:39:52Z")

</div>

I have done. Please see my post here:

> [@What does "A secure connection is required for log in" mean?](https://discuss.elastic.co/t/what-does-a-secure-connection-is-required-for-log-in-mean/168355/5):
>
> It is really not a simple task. It cost me around 6 hours to figure it out. Some facts are missing in the online documents of Elasticsearch. I am using CentOS 7, elasticsearch and kibana 6.5. (1) generate server certificate for kibana Use elasticsearch-certutil in the installation directory of elasticsearch, since kibana installation directory has no such utility details see: [https://www.elastic.co/guide/en/elasticsearch/reference/current/certutil.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/certutil.html) But you need to create a yml file for …

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 16, 2019, 7:39am UTC](https://discuss.elastic.co/t/how-to-establish-secured-connection-to-elasticsearch/167783/6 "2019-03-16T07:39:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
