Craft-CacheWarmer icon indicating copy to clipboard operation
Craft-CacheWarmer copied to clipboard

Issue with SSL and Guzzle

Open hisnameisjimmy opened this issue 6 years ago • 2 comments

Running into an issue with Guzzle where it wants the SSL certificate info. Looked into it, it appears you need to specify a verify if you have an SSL: http://guzzle.readthedocs.io/en/stable/request-options.html#verify-option

If we could expose this through the GUI, so that you could append a path instead of modifying the plugin code, I think it would be good to avoid this issue.

hisnameisjimmy avatar Jan 04 '18 14:01 hisnameisjimmy

Isn't this a problem with the target host not having a valid certificate?

sjelfull avatar Jan 04 '18 16:01 sjelfull

It's more a problem with Guzzle not being able to find it in normal locations, I believe.

I'm using Forge by Laravel, and their location for the file is: /etc/nginx/ssl/domain.com/#####/cert.crt

I modified your code to reflect the correct path with a setDefaultOption that points to the correct bundle file:

            // Create client
            $client = new Guzzle();
            $client->setDefaultOption('verify', '/etc/nginx/ssl/domain.com/#####/bundle.crt');
            // Create a new pool and send off requests, 20 at a time
            $transferStrategy = new BatchRequestTransfer($this->settings->parallelRequests);
            $divisorStrategy = $transferStrategy;
            $batch = new Batch($transferStrategy, $divisorStrategy);

This fixed the issue. I'm gonna fork your repo and create a settings input that allows you to specify this in the GUI. I'll then drop you a pull request.

hisnameisjimmy avatar Jan 05 '18 11:01 hisnameisjimmy