# Merticbeat Error dialing x509: certificate is valid for 127.0.0.1, not 172.16.0.204

**URL:** https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323
**Category:** Beats
**Tags:** metricbeat
**Created:** [March 10, 2022, 10:47am UTC](https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323 "2022-03-10T10:47:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Spyros\_Agriopoulos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spyros_agriopoulos/32/99497_2.png) [@Spyros\_Agriopoulos](https://discuss.elastic.co/u/Spyros_Agriopoulos)
#### Post date: [March 10, 2022, 10:47am UTC](https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323/1 "2022-03-10T10:47:02Z")

</div>

Metricbeat has stopped working and is giving me Error dialing x509: certificate is valid for 127.0.0.1, not x.x.x.x after a yum update. Other instances that are using the exact same certificate are working fine. Any ideas?

```auto
# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["x.x.x.x:9200"]

  # Protocol - either `http` (default) or `https`.
  protocol: "https"
  ssl.certificate_authorities: ["/home/user/elastic/ca/ca.crt"]
  # Authentication credentials - either API key or username/password.
  #api_key: "id:api_key"
  username: "user"
  password: "pass"

```

#### UPDATE

With older versions of metricbeat it works, is this a known issue?

---

<div class="post-metadata">

### Author: ![Marius\_Iversen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_iversen/32/68988_2.png) [@Marius\_Iversen](https://discuss.elastic.co/u/Marius_Iversen)
#### Post date: [March 10, 2022, 1:30pm UTC](https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323/2 "2022-03-10T13:30:10Z")

</div>

Did you perhaps upgrade from 7 to 8 for the metricbeat?

It does seem that the certificate is not valid for that host, and there might be more checks that has been added, from 8.0+ the Elastic stack has security enabled by default.

You can try to disable verification to see if it starts up as intended then? It's not a "fix" unless you are happy with having it disabled, but the complaint about the certificate missmatch seems correct.  
See if you can set:  
`output.elasticsearch.ssl.verification_mode: none`

---

<div class="post-metadata">

### Author: ![TiagoQueiroz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tiagoqueiroz/32/107061_2.png) [@TiagoQueiroz](https://discuss.elastic.co/u/TiagoQueiroz)
#### Post date: [March 10, 2022, 3:19pm UTC](https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323/3 "2022-03-10T15:19:18Z")

</div>

> [@Spyros\_Agriopoulos](#):
>
> x509: certificate is valid

Yes, that's a know issue, but the fix has been merged to `main` a little while ago. There are some GitHub issues (and the fix PR):

- [Filebeat Loadbalance wrong cert validation · Issue #30240 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/30240)
- [[Heartbeat] Mixup of TLS certificates on multi-monitor configs · Issue #30290 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/30290)
- [tlscommon: fix race condition on TLS hostname validation by belimawr · Pull Request #30305 · elastic/beats · GitHub](https://github.com/elastic/beats/pull/30305)

Which version of Metricbeat are you running @Spyros_Agriopoulos. The fix has been released on [7.17.1](https://www.elastic.co/guide/en/beats/libbeat/7.17/release-notes-7.17.1.html)

There is also a simple workaround of setting `ssl.verification_mode: certificate`

---

<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: [April 7, 2022, 5:19pm UTC](https://discuss.elastic.co/t/merticbeat-error-dialing-x509-certificate-is-valid-for-127-0-0-1-not-172-16-0-204/299323/4 "2022-04-07T17:19:33Z")

</div>

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