# Connection Filebeat to Logstash SSL: certificate specifies an incompatible key usage

**URL:** <https://discuss.elastic.co/t/connection-filebeat-to-logstash-ssl-certificate-specifies-an-incompatible-key-usage/250684>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [October 1, 2020, 1:37pm UTC](https://discuss.elastic.co/t/connection-filebeat-to-logstash-ssl-certificate-specifies-an-incompatible-key-usage/250684 "2020-10-01T13:37:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterol](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@peterol](https://discuss.elastic.co/u/peterol)\
**Post date:** [October 1, 2020, 1:37pm UTC](https://discuss.elastic.co/t/connection-filebeat-to-logstash-ssl-certificate-specifies-an-incompatible-key-usage/250684/1 "2020-10-01T13:37:31Z")

</div>

Hey everyone,

I want to establish a connection with SSL between Filebeat and Logstash according to [this](https://www.elastic.co/guide/en/beats/filebeat/current/configuring-ssl-logstash.html). Filebeat runs natively whereas Logstash is running in a Docker container. I converted my keys to the PKCS8 format, using the command:

```auto
 openssl pkcs8 -topk8 -inform PEM -outform PEM -in infile.key -out outfile.pkcs8.key -nocrypt 

```

But in Filebeat I get the error:

```auto
Failed to connect to backoff(async(tcp://logstash.domain.de:5045)): x509: certificate specifies an incompatible key usage

```

and in Logstash as soon as Filebeat tries to connect:

```auto
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate

```

I also tried a traditional PEM key in Filebeat with the same result.

**This is my configuration:**  
input.conf:

```auto
input {
  beats {
    port => 5045
    ssl => true
    ssl_certificate_authorities => ["/usr/share/logstash/config/certs/cacert.pem"]
    ssl_certificate => "/usr/share/logstash/config/certs/cert.pem"
    ssl_key => "/usr/share/logstash/config/certs/key.pkcs8.key"
    # deactivated for now
    ssl_verify_mode => "none"
    client_inactivity_timeout => 120
  }
}

```

filebeat.yml:

```auto
output.logstash:
  # The Logstash hosts
  hosts: ["logstash.domain.de:5045"]

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  ssl.certificate_authorities: ["/etc/certs/cacert.pem"]
  
  # Certificate for SSL client authentication
  ssl.certificate: "/etc/certs/cert.pem"
  
  # Client Certificate Key
  ssl.key: "/etc/certs/key.pkcs8.key"

```

I use the same certificates and keys to communicate with my Elasticsearch cluster with no problems, so they should be okay. The only difference is the PKCS8 format used here.

Thanks a lot for any 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:** [October 29, 2020, 3:37pm UTC](https://discuss.elastic.co/t/connection-filebeat-to-logstash-ssl-certificate-specifies-an-incompatible-key-usage/250684/2 "2020-10-29T15:37:41Z")

</div>

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