# Elasticsearch-setup-passwords ssl connection issue

**URL:** <https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [January 8, 2019, 2:28pm UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382 "2019-01-08T14:28:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rani](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@rani](https://discuss.elastic.co/u/rani)\
**Post date:** [January 8, 2019, 2:28pm UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/1 "2019-01-08T14:28:14Z")

</div>

Hello there

I need to change the passwords via the "elasticsearch-setup-passwords" command. It's been working without any problems until I secured my connections with TLS.

Now I get the following error:

```
SSL connection to https://elasticsearch1:9200/_xpack/security/_authenticate?pretty failed: PKIX path 
building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Please check the elasticsearch SSL settings under xpack.security.http.ssl.

ERROR: Failed to establish SSL connection to elasticsearch at https://elasticsearch1:9200/_xpack/security/_authenticate?pretty.

```

I've tried to fix it with [this](https://www.elastic.co/guide/en/elastic-stack-overview/current/trb-security-setup.html) troubleshooting guide but I couldn't fix it.

I would appreciate any advice or hints, thank you in advance!

---

<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:** [January 9, 2019, 3:44am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/2 "2019-01-09T03:44:41Z")

</div>

> [@rani](#):
>
> I've tried to fix it with [this](https://www.elastic.co/guide/en/elastic-stack-overview/current/trb-security-setup.html) troubleshooting guide but I couldn't fix it.

That guide has the right instructions for fixing this - what exactly did you do?

---

<div class="post-metadata">

**Author:** ![rani](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@rani](https://discuss.elastic.co/u/rani)\
**Post date:** [January 9, 2019, 6:54am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/3 "2019-01-09T06:54:17Z")

</div>

I added the following lines to my elasticsearch.yml:

```
xpack.security.http.ssl.certificate_authorities: /usr/share/elasticsearch/config/ca-chain.crt
xpack.security.http.ssl.key: /usr/share/elasticsearch/config/private.key
xpack.security.http.ssl.certificate: /usr/share/elasticsearch/config/certificate.crt

```

My ssl settings now look like this:

```
xpack.ssl.verification_mode: certificate
xpack.security.http.ssl.enabled: true
xpack.ssl.certificate_authorities: /usr/share/elasticsearch/config/ca-chain.crt
xpack.ssl.key: /usr/share/elasticsearch/config/private.key
xpack.ssl.certificate: /usr/share/elasticsearch/config/certificate.crt
xpack.security.http.ssl.certificate_authorities: /usr/share/elasticsearch/config/ca-chain.crt
xpack.security.http.ssl.key: /usr/share/elasticsearch/config/private.key
xpack.security.http.ssl.certificate: /usr/share/elasticsearch/config/certificate.crt
```

---

<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:** [January 9, 2019, 12:33pm UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/4 "2019-01-09T12:33:50Z")

</div>

Hi Nick,

> I need to change the passwords via the "elasticsearch-setup-passwords" command. It's been working without any problems until I secured my connections with TLS.

Please note that you can't change the passwords of the built-in users with `elasticsearch-setup-passwords` once these are already set. See [our documentation](https://www.elastic.co/guide/en/elastic-stack-overview/6.5/built-in-users.html#built-in-user-explanation) for more details. If you have run `elasticsearch-setup-passwords` already, you can change the password using the [change password API](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/security-api-change-password.html)

If the above is not the case, we can focus on your described issue which looks likely caused by the fact that the `ca-chain.crt` cannot be used to verify the certificate contained in`certificate.crt`. Can you share more information on how these were created and whether the `certificate.crt` is signed with the CA key that corresponds to the certificate in `ca-chain.crt`?

---

<div class="post-metadata">

**Author:** ![rani](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@rani](https://discuss.elastic.co/u/rani)\
**Post date:** [January 15, 2019, 7:42am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/5 "2019-01-15T07:42:22Z")

</div>

Hi Ioannis

You guys were right, the problem was caused by the ca-chain.crt, I was given an incomplete one.  
Now everything is working properly. Thanks for your help!

---

<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:** [February 12, 2019, 7:42am UTC](https://discuss.elastic.co/t/elasticsearch-setup-passwords-ssl-connection-issue/163382/6 "2019-02-12T07:42:27Z")

</div>

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