In output beats, I used different approaches, creating a separate p12 storage in the same way as for logstash, from which I then took out the key and certificate for beats. I also used the logstash certificate itself, but I got SSL errors. The last example of what I tried using the settings:
[2025-05-02T19:02:02,741][WARN ][io.netty.channel.DefaultChannelPipeline][main][5036d1d5e0ca7bd9c07af2050b1d7965127518bd086130be02b9f8fd80ece896] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:500) ~[netty-codec-4.1.109.Final.jar:4.1.109.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.109.Final.jar:4.1.109.Final]
Thank you all for your answers. This is actually my mistake, but I've also tried this option before. In this case, I was getting a different error :
[2025-05-04T17:17:02,007][WARN ][io.netty.channel.DefaultChannelPipeline][main][b69a2eb3cac144215f5159fc01021d41845460d18e73f609de0fb868bbf430b5] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: Empty client certificate chain
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:500) ~[netty-codec-4.1.109.Final.jar:4.1.109.Final]
I also used other commands to generate certificates.
I tried to do what was mentioned above. It didn't help, the error remained the same:
[2025-05-05T07:44:01,838][WARN ][io.netty.channel.DefaultChannelPipeline][main][e22721fd705d0d15e154244309c305d07a4b9acdc0df80c0c3baac2539120e57] An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: Empty client certificate chain
After that, I re-created the certificates for beats with the following command:
Accordingly, I made changes to the configuration and restarted the service.
output.logstash:
hosts: ["logstash:5044"]
ssl:
enabled: true # I also removed and returned this option.
certificate_authorities: ["/etc/pki/root/ca.crt"]
ssl.certificate: "/etc/pki/beats/beat.crt"
ssl.key: "/etc/pki/beats/beat.key"
I'm trying to set up SSL/TLS between Beats and Logstash using certificates I generated with elasticsearch-certutil and openssl. The Logstash input config expects client authentication, and I provided the necessary certs and keys, including logstash.pkcs8.key and client.crt.
CopyEdit
SSLHandshakeException: Received fatal alert: bad_certificate
What's likely wrong?
This error usually means:
The certificate sent by Beats is either not valid, not trusted by Logstash, or
It doesn't match the private key, or
The CA that issued the cert is missing or wrong in ssl_certificate_authorities.
Suggestions:
Use a separate certificate for Beats:
Logstash and Beats should each have their own client certificate signed by the same CA. Don't reuse logstash.pkcs8.key for Beats.
Check the CA:
Make sure the ca.crt used by both Logstash and Beats is the same one that issued the client certs.
They should output the same hash.
4. Set correct permissions on all cert/key files and avoid formatting issues (e.g., no spaces in filenames like pkcs 8.key → rename it to pkcs8.key).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.