# Configure xpack for Elastic Search and Kibana with Active Directory

**URL:** https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584
**Category:** Kibana
**Created:** [April 26, 2018, 3:39am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584 "2018-04-26T03:39:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![stargate](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@stargate](https://discuss.elastic.co/u/stargate)
#### Post date: [April 26, 2018, 3:39am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/1 "2018-04-26T03:39:01Z")

</div>

Hi,

We are using trial version of xpack security for ElasticSearch & Kibana and running it on a single node.  
We have configured 'elasticsearch.yml' and 'kibana.yml' config files with the active directory details.

I have attached the relevant log files for your reference.

//Kibana Logs  
\<\>  
{"type":"log","@timestamp":"2018-04-26T03:35:39Z","tags":["reporting","esqueue","worker","debug"],"pid":1264,"message":"jgfyl14o00z45c74056u16y8 - job querying failed: [security\_exception] missing authentication token for REST request [/.reporting-_/esqueue/\_search?version=true], with { header={ WWW-Authenticate="Basic realm=\"security\" charset=\"UTF-8\"" } } :: {"path":"/.reporting-_/esqueue/\_search","query":{"version":true},"body":"{\"\_source\":{\"excludes\":[\"output.content\"]},\"query\":{\"constant\_score\":{\"filter\":{\"bool\":{\"filter\":{\"term\":{\"jobtype\":\"csv\"}},\"should\":[{\"term\":{\"status\":\"pending\"}},{\"bool\":{\"filter\":[{\"term\":{\"status\":\"processing\"}},{\"range\":{\"process\_expiration\":{\"lte\":\"2018-04-26T03:35:39.405Z\"}}}]}}]}}}},\"sort\":[{\"priority\":{\"order\":\"asc\"}},{\"created\_at\":{\"order\":\"asc\"}}],\"size\":10}","statusCode":401,"response":"{\"error\":{\"root\_cause\":[{\"type\":\"security\_exception\",\"reason\":\"missing authentication token for REST request [/.reporting-_/esqueue/\_search?version=true]\",\"header\":{\"WWW-Authenticate\":\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\"}}],\"type\":\"security\_exception\",\"reason\":\"missing authentication token for REST request [/.reporting-_/esqueue/\_search?version=true]\",\"header\":{\"WWW-Authenticate\":\"Basic realm=\\\"security\\\" charset=\\\"UTF-8\\\"\"}},\"status\":401}","wwwAuthenticateDirective":"Basic realm=\"security\" charset=\"UTF-8\""}\n at respond (C:\Program Files\ElasticStack\kibana\node\_modules\elasticsearch\src\lib\transport.js:295:15)\n at checkRespForFailure (C:\Program Files\ElasticStack\kibana\node\_modules\elasticsearch\src\lib\transport.js:254:7)\n at HttpConnector. (C:\Program Files\ElasticStack\kibana\node\_modules\elasticsearch\src\lib\connectors\http.js:159:7)\n at IncomingMessage.bound (C:\Program Files\ElasticStack\kibana\node\_modules\elasticsearch\node\_modules\lodash\dist\lodash.js:729:21)\n at emitNone (events.js:91:20)\n at IncomingMessage.emit (events.js:185:7)\n at endReadableNT (\_stream\_readable.js:974:12)\n at \_combinedTickCallback (internal/process/next\_tick.js:80:11)\n at process.\_tickDomainCallback (internal/process/next\_tick.js:128:9)"}  
\</\>

However, when I try to login to Kibana using the url '[https://win7-iet-001:5601](https://win7-iet-001:5601)' we get the following as shown in the screenshot.

//This is what I get when I browse to '[https://win7-iet-001:5601](https://win7-iet-001:5601)'  
\<\>  
ID Status  
plugin:kibana@6.2.2 Ready  
plugin:elasticsearch@6.2.2 Authentication Exception  
plugin:xpack\_main@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:searchprofiler@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:ml@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:tilemap@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:watcher@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:license\_management@6.2.2 Ready  
plugin:graph@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:monitoring@6.2.2 Ready  
plugin:reporting@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:grokdebugger@6.2.2 Ready  
plugin:dashboard\_mode@6.2.2 Ready  
plugin:logstash@6.2.2 [security\_exception] missing authentication token for REST request [/\_xpack], with { header={ WWW-Authenticate="Basic realm="security" charset="UTF-8"" } }  
plugin:apm@6.2.2 Ready  
plugin:console@6.2.2 Ready  
plugin:metrics@6.2.2 Ready  
plugin:timelion@6.2.2 Ready  
\</\>

I was wondering if someone at Elastic can help us achieve this without any issues.

Regards,  
Anand

---

<div class="post-metadata">

### Author: ![stargate](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@stargate](https://discuss.elastic.co/u/stargate)
#### Post date: [April 26, 2018, 5:23am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/2 "2018-04-26T05:23:44Z")

</div>

I have managed to resolve this issue by changing the below details in kibana.yml file with an AD user.

elasticsearch.username: ""  
elasticsearch.password: ""

Thanks.

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [April 26, 2018, 6:25am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/3 "2018-04-26T06:25:21Z")

</div>

Hi there,

The errors you were getting were because Kibana could not communicate to Elasticsearch as you figured out, but

> [@stargate](#):
>
> I have managed to resolve this issue by changing the below details in kibana.yml file with an AD user.
> 
> elasticsearch.username: ""
> 
> elasticsearch.password: ""

is **not** a good practice.

Kibana needs to communicate with elasticsearch using a user that has the correct role/permissions. For this, the `kibana` [internal user](https://www.elastic.co/guide/en/x-pack/current/setting-up-authentication.html#built-in-users) is shipped with Elasticsearch. It would be preferable to configure this user in `kibana.yml`. You can look at [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-passwords.html) to see how to set the password for the Kibana user.

---

<div class="post-metadata">

### Author: ![stargate](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@stargate](https://discuss.elastic.co/u/stargate)
#### Post date: [April 26, 2018, 7:19am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/4 "2018-04-26T07:19:33Z")

</div>

Thanks for your reply. How was use the built in roles in my kibana.yml file to fix the above issues?

---

<div class="post-metadata">

### Author: ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)
#### Post date: [April 26, 2018, 7:24am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/5 "2018-04-26T07:24:19Z")

</div>

1. Set the password for the `kibana` internal user as mentioned

> [@ikakavas](#):
>
> You can look at [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-passwords.html) to see how to set the password for the Kibana user.

1. Set

```auto
elasticsearch.username: "kibana"
elasticsearch.password: "<the password you set at step 1>"

```

in kibana.yml and restart Kibana

---

<div class="post-metadata">

### Author: ![stargate](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@stargate](https://discuss.elastic.co/u/stargate)
#### Post date: [April 27, 2018, 5:34am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/6 "2018-04-27T05:34:41Z")

</div>

I have now created passwords for Elastic, Kibana and Logstash\_system users and configured the kibana user password in kibana.yml file. After restarting Kibana, everything looks good.

---

<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: [May 25, 2018, 5:34am UTC](https://discuss.elastic.co/t/configure-xpack-for-elastic-search-and-kibana-with-active-directory/129584/7 "2018-05-25T05:34:47Z")

</div>

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