elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
35 stars 970 forks source link

SSL Certificate problem #1174

Closed realtebo closed 2 years ago

realtebo commented 3 years ago

Summary of problem or feature request

I got an error of this type

"error" => GuzzleHttp\Ring\Exception\RingException {#1909 ▼

message: "cURL error 60: SSL certificate problem: self signed certificate in certificate chain"

#code: 0
#file: "C:\laragon\www\mk-frontend\vendor\ezimuel\ringphp\src\Client\CurlFactory.php"

Code snippet of problem

We are using your package through the wrapper laravel-elasticsearch

System details

Postman can do an api call without problems Also, from the same system, using git bash for windows, I can use curl to succesfully call to this instance

This problem is happening to me only since 2 days, but I've no idea of how to diagnose the source of the problem

Is there a way to ask your package to skip SSL validation

ezimuel commented 2 years ago

@realtebo you can disable the SSL verification form the client build using the setSSLVerification(false) function, as follows:

$client = ClientBuilder::create()
    ->setSslVerification(false)
    ->build();

Of course, this is not the recommended settings. I suggest to have a look at the SSL configuration section of the manual.

realtebo commented 2 years ago

I suppose it was a config problem on the remote server of hosted elastic search instance. We reenabled ssl verification 2 days ago and all works. I still cannot understand why only this library was complaining about the self signed certificate; postman, curl, browser, and other tools (either web) do not see aything of wrong in the certificate. I close.