# Is it possible Mutual authentication between Logstash and Beats

**URL:** <https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017>\
**Category:** Beats\
**Created:** [December 8, 2019, 4:10pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017 "2019-12-08T16:10:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fedele\_Mantuano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fedele_mantuano/32/9225_2.png) [@Fedele\_Mantuano](https://discuss.elastic.co/u/Fedele_Mantuano)\
**Post date:** [December 8, 2019, 4:10pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/1 "2019-12-08T16:10:07Z")

</div>

Hi community,

my question is very easy. Is it possible the [Mutual authentication](https://en.wikipedia.org/wiki/Mutual_authentication) between Logstash and Beats. I can authenticate the server Logstash, but is there a way to authenticate the client?  
I'd like to have different certificates for every beats node to solve many security incidents.

Regards,  
Fedele

---

<div class="post-metadata">

**Author:** ![Sunil\_Chadha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_chadha/32/44019_2.png) [@Sunil\_Chadha](https://discuss.elastic.co/u/Sunil_Chadha)\
**Post date:** [December 8, 2019, 5:15pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/2 "2019-12-08T17:15:31Z")

</div>

Yes it is possible. You need to refer to Beats Logstash configuration and Logstash Beats input configuration. Read optional SSL configuration parameters.

---

<div class="post-metadata">

**Author:** ![Fedele\_Mantuano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fedele_mantuano/32/9225_2.png) [@Fedele\_Mantuano](https://discuss.elastic.co/u/Fedele_Mantuano)\
**Post date:** [December 8, 2019, 11:25pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/3 "2019-12-08T23:25:17Z")

</div>

I used the following steps.

Logstash input part

```auto
    beats {
        port => 5044
        ssl => true
        ssl_certificate_authorities => ["/tmp/certs/ca.crt"]
        ssl_certificate => "/tmp/certs/logstash.crt"
        ssl_key => "/tmp/certs/logstash.pk8"
        ssl_verify_mode => "force_peer"
        tags => ["syslog"]
  }

```

Filebeat output part

```auto
output.logstash:
  # The Logstash hosts
  hosts: ["instance:5044"]

  # Optional SSL. By default is off.
  # List of root certificates for HTTPS server verifications
  ssl.certificate_authorities: ["/tmp/certs/ca.crt"]

  # Certificate for SSL client authentication
  ssl.certificate: "/tmp/certs/filebeat.crt"

  # Client Certificate Key
  ssl.key: "/tmp/certs/filebeat.key"

```

Command for certificates:

```auto
# CA
$ /usr/share/elasticsearch/bin/elasticsearch-certutil ca --pem --days 3650 -s

# Logstash cert
$ /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca-cert /root/certs/ca.crt --ca-key /root/certs/ca.key --days 3650 --pem --dns istance

# Filebeat cert
$ /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca-cert /root/certs/ca.crt --ca-key /root/certs/ca.key --days 3650 --pem --dns fake

```

This configuration works but Logstash doesn't authenticate the client.

Can you help me?

---

<div class="post-metadata">

**Author:** ![Sunil\_Chadha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_chadha/32/44019_2.png) [@Sunil\_Chadha](https://discuss.elastic.co/u/Sunil_Chadha)\
**Post date:** [December 9, 2019, 9:38pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/4 "2019-12-09T21:38:27Z")

</div>

For Logstash Beats input plugin  
[https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html#plugins-inputs-beats-ssl\_verify\_mode](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-beats.html#plugins-inputs-beats-ssl_verify_mode)

set ssl\_verify\_mode to {force\_peer}.

for Beats output  
[https://www.elastic.co/guide/en/beats/filebeat/6.6/configuration-ssl.html#\_verification\_mode](https://www.elastic.co/guide/en/beats/filebeat/6.6/configuration-ssl.html#_verification_mode)  
set verification\_mode to {full}

When you say Logstash does not verify client, what is the error you get in Logstash log.

---

<div class="post-metadata">

**Author:** ![Fedele\_Mantuano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fedele_mantuano/32/9225_2.png) [@Fedele\_Mantuano](https://discuss.elastic.co/u/Fedele_Mantuano)\
**Post date:** [December 9, 2019, 10:25pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/5 "2019-12-09T22:25:40Z")

</div>

> When you say Logstash does not verify client, what is the error you get in Logstash log.  
> I used 2 different certificates, with real and fake hostname and I could write in elasticsearch.  
> So maybe there is a problem in my configuration.  
> I'm using `force_peer` for logstash and `verification_mode: full` for beats, but It doesn't work.

---

<div class="post-metadata">

**Author:** ![Sunil\_Chadha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunil_chadha/32/44019_2.png) [@Sunil\_Chadha](https://discuss.elastic.co/u/Sunil_Chadha)\
**Post date:** [December 9, 2019, 11:27pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/6 "2019-12-09T23:27:20Z")

</div>

Check logs in filebeat and logstash and see error for connecting.

---

<div class="post-metadata">

**Author:** ![Fedele\_Mantuano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fedele_mantuano/32/9225_2.png) [@Fedele\_Mantuano](https://discuss.elastic.co/u/Fedele_Mantuano)\
**Post date:** [December 10, 2019, 2:40pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/7 "2019-12-10T14:40:27Z")

</div>

I don't have any errors. The configuration with certificate with fake name for beat works.  
This is my problem. I'd like that with fake certificate logstash rejects connection.

---

<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:** [January 5, 2020, 4:10pm UTC](https://discuss.elastic.co/t/is-it-possible-mutual-authentication-between-logstash-and-beats/211017/8 "2020-01-05T16:10:10Z")

</div>

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