# Kibana does not connect to elasticsearch with security enabled

**URL:** <https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [May 28, 2019, 1:45am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974 "2019-05-28T01:45:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [May 28, 2019, 1:46am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974/1 "2019-05-28T01:46:00Z")

</div>

Hello,

I have enabled security on elasticsearch 7.1.0. I have configured everything as shown in the blog but when I start kibana I get the following in the logs: [https://pastebin.com/7DwrKuYh](https://pastebin.com/7DwrKuYh)

My kibana.yml looks like this:

```
server.port: 5601
server.host: "0.0.0.0"
server.maxPayloadBytes: 1048576
server.name: "z0z0"
elasticsearch.hosts: ["http://127.0.0.1:9200"]
elasticsearch.preserveHost: true
kibana.index: ".kibana"
kibana.defaultAppId: "home"
elasticsearch.username: "kibana"
elasticsearch.password: "X70dOp4q9JZRXR5zzQ71"
elasticsearch.pingTimeout: 1500
elasticsearch.requestTimeout: 30000
elasticsearch.shardTimeout: 30000
elasticsearch.startupTimeout: 5000
elasticsearch.logQueries: false
pid.file: /var/run/kibana/kibana.pid
logging.dest: stdout
logging.silent: false
logging.quiet: true
logging.verbose: false
ops.interval: 5000
i18n.locale: "en"

```

while I can successfully run curl request with that user on elasticsearch:

```auto
 curl -u kibana:X70dOp4q9JZRXR5zzQ71 localhost:9200/_cluster/health?pretty
{
  "cluster_name" : "z0z0",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 69,
  "active_shards" : 69,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 31,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 69.0
}

```

Any idea how to fix it?

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [May 28, 2019, 2:18am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974/2 "2019-05-28T02:18:34Z")

</div>

All your logs say:

```auto
[security_exception] failed to authenticate user [elastic]

```

But your Kibana config has:

```auto
elasticsearch.username: "kibana"

```

That doesn't make sense. Your logs should be reporting errors for the user you have configured (`kibana`, not `elastic`).

Are you sure that you're showing us the current logs and the correct config file?

Did you have `elastic` in that config file at some point, and if so have you restarted Kibana since you changed it?

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [May 28, 2019, 2:20am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974/3 "2019-05-28T02:20:34Z")

</div>

I have only one file and looking into the syslog. I do not understand where is the elastic user coming from either.

---

<div class="post-metadata">

**Author:** ![zozo6015](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zozo6015/32/12117_2.png) [@zozo6015](https://discuss.elastic.co/u/zozo6015)\
**Post date:** [May 28, 2019, 10:26am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974/4 "2019-05-28T10:26:15Z")

</div>

Uninstalled kibana, manually removed all the references to kibana from the OS then reinstalled it and reconfigured it, Solved the problem. Honestly I have no idea why it was trying to authenticate as elastic user at all. But the problem now is solved.

---

<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:** [June 25, 2019, 10:26am UTC](https://discuss.elastic.co/t/kibana-does-not-connect-to-elasticsearch-with-security-enabled/182974/5 "2019-06-25T10:26:18Z")

</div>

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