# Auto authenticate with Ealsticsearch shield using PKI

**URL:** <https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [August 10, 2016, 4:26pm UTC](https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725 "2016-08-10T16:26:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kqpr0](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kqpr0](https://discuss.elastic.co/u/kqpr0)\
**Post date:** [August 10, 2016, 4:26pm UTC](https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725/1 "2016-08-10T16:26:13Z")

</div>

I am using the shield addon for my elasticsearch. I want to configure Shield to auto authenticate when a user hit the rest endpoint in the browser, looking at the browser's cert. How can i achieve this?

In my elasticsearch.yml I have:

> shield.transport.ssl: true  
> shield.http.ssl: true  
> shield.ssl.keystore.path : /path/keystore.jks  
> shield.ssl.keystore.password: password

> shield.authc.realms.pki1.type: pki  
> shield.authc.realms.pki1.truststore.path: path/allTruststore.jks  
> shield.authc.realms.pki1.truststore.password: changeme

But the authentication window still pops up every time asking for a log in.

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [August 10, 2016, 8:19pm UTC](https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725/2 "2016-08-10T20:19:47Z")

</div>

You also need to enable client authentication for http. Set `shield.http.ssl.client.auth: optional` in your elasticsearch.yml. This will request the client certificate and if not presented, it will allow fallback to username/password authentication.

---

<div class="post-metadata">

**Author:** ![kqpr0](https://avatars.discourse-cdn.com/v4/letter/k/dc4da7/32.png) [@kqpr0](https://discuss.elastic.co/u/kqpr0)\
**Post date:** [August 10, 2016, 8:37pm UTC](https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725/3 "2016-08-10T20:37:18Z")

</div>

I set to Required, and i got a ssl\_error\_bad\_cert\_alert. Guess im getting somewhere..

---

<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:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/auto-authenticate-with-ealsticsearch-shield-using-pki/57725/4 "2017-07-06T13:42:22Z")

</div>


