# Anyone please help on create keys/certs for filebeat 5 to logstash?

**URL:** <https://discuss.elastic.co/t/anyone-please-help-on-create-keys-certs-for-filebeat-5-to-logstash/68353>\
**Category:** Logstash\
**Created:** [December 7, 2016, 7:30pm UTC](https://discuss.elastic.co/t/anyone-please-help-on-create-keys-certs-for-filebeat-5-to-logstash/68353 "2016-12-07T19:30:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertchen117](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@robertchen117](https://discuss.elastic.co/u/robertchen117)\
**Post date:** [December 7, 2016, 7:30pm UTC](https://discuss.elastic.co/t/anyone-please-help-on-create-keys-certs-for-filebeat-5-to-logstash/68353/1 "2016-12-07T19:30:19Z")

</div>

The doc ([https://www.elastic.co/guide/en/beats/filebeat/5.0/configuring-ssl-logstash.html](https://www.elastic.co/guide/en/beats/filebeat/5.0/configuring-ssl-logstash.html) )did not say which way to create these keys/certificates, I tried to create with openssl two-way SSL but does not work, error is:  
[2016-12-07T14:25:01,198][ERROR][logstash.inputs.beats] Looks like you either have an invalid key or your private key was not in PKCS8 format. {:exception=\>java.lang.IllegalArgumentException: File does not contain valid private key: /etc/logstash/logstash.key}

output.logstash:  
hosts: ["[logs.mycompany.com:5044](http://logs.mycompany.com:5044)"]  
ssl.certificate\_authorities: ["/etc/ca.crt"]  
ssl.certificate: "/etc/client.crt"  
ssl.key: "/etc/client.key"

input {  
beats {  
port =\> 5044  
ssl =\> true  
ssl\_certificate\_authorities =\> ["/etc/ca.crt"]  
ssl\_certificate =\> "/etc/server.crt"  
ssl\_key =\> "/etc/server.key"  
ssl\_verify\_mode =\> "force\_peer"  
}  
}

Please give me a full list of commands or a guide which works.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 8, 2016, 6:36am UTC](https://discuss.elastic.co/t/anyone-please-help-on-create-keys-certs-for-filebeat-5-to-logstash/68353/2 "2016-12-08T06:36:20Z")

</div>

I've always been able to use an adaptation of what's in [https://github.com/elastic/logstash-forwarder/blob/master/README.md:](https://github.com/elastic/logstash-forwarder/blob/master/README.md:)

```
openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout lumberjack.key -out lumberjack.crt -subj /CN=logstash.example.com
```

---

<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, 2017, 6:36am UTC](https://discuss.elastic.co/t/anyone-please-help-on-create-keys-certs-for-filebeat-5-to-logstash/68353/3 "2017-01-05T06:36:34Z")

</div>

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