hedii / laravel-gelf-logger

A package to send gelf logs to a gelf compatible backend like graylog
MIT License
125 stars 33 forks source link

RuntimeException when Graylog SSL expired #32

Closed florianbrinkmann closed 2 years ago

florianbrinkmann commented 3 years ago

Hi,

first, thanks for the package!

I ran into an issue while using it and connecting to a Graylog instance via HTTPS. The Graylog SSL expired and I got the following error:

Failed to create socket-client for ssl://graylog.example.com:6000: (0) {"userId":1,"exception":"[object] (RuntimeException(code: 0): Failed to create socket-client for ssl://graylog.example.com:6000: (0) at /path/to/laravel/vendor/graylog2/gelf-php/src/Gelf/Transport/StreamSocketClient.php:157)

Is that something that can be fixed in your package, or does the Exception need to be handled in graylog2/gelf-php?

Thanks!

hedii commented 3 years ago

Hi, why not simply fix the certificate?

There is an SslOptions class for the TcpTransport in graylog2/gelf-php, but we are not using it.

The SslOptions class has a method to enable or disable the peer certificate check.

If you cannot renew the graylog host certificate, maybe you should use graylog2/gelf-php directly with the ssl options instead of using hedii/laravel-gelf-logger.

Or submit a tested PR here to add this new functionality for the tcp transport.

florianbrinkmann commented 3 years ago

Hi, yes, the certificate was renewed now, but I thought it would be nice if no exception would be thrown if the certificate is invalid for some reason. I will see if I can provide a PR.

hedii commented 2 years ago

I am closing but feel free to submit your PR regarding the certificate validation.

hedii commented 2 years ago

@florianbrinkmann check release 6.2.0

You can now use ssl on tcp and http transports, with an option to enable or disable certificate validation on peer.

florianbrinkmann commented 2 years ago

Thanks a lot @hedii! And sorry I did not follow up with a PR myself, the cert renewal was working now so the issue did not appear again and I forgot it…