Revision 55553c3ad6ae2121c1b1475d4c880d71b31b8f68

Committed on 22/08/2017 3:18 pm by Fabien Potencier <[email protected]> [GitHub Diff]

bug #98 Fix setting certificate locations (David Arenas)

This PR was submitted for the master branch but it was merged into the 4.1 branch instead (closes #98).

Discussion
----------

Fix setting certificate locations

`CaBundle::getSystemCaRootBundlePath()` can return either the CA path or file.

`CURLOPT_CAINFO` expects a file so when passing a path security-checker command fails.

This is my system cert locations:

```
$ php -r 'print_r(openssl_get_cert_locations());'
Array
(
[default_cert_file] => /usr/lib/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => /usr/lib/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => /usr/lib/ssl/private
[default_default_cert_area] => /usr/lib/ssl
[ini_cafile] =>
[ini_capath] => /usr/lib/ssl/certs
)
```

If I run `vendor/bin/security-checker -vvv security:check composer.lock`

When using `CurlCrawler` I get the following error:
> An error occurred: error setting certificate verify locations:
> CAfile: /usr/lib/ssl/certs
> CApath: /etc/ssl/certs.

When using `FileGetContentsCrawler` I get the following error:
> An error occurred: file_get_contents(https://security.sensiolabs.org/check_lock): failed to open stream: operation failed.

Usage section of composer/ca-bundle recommends checking with is_dir:
> https://github.com/composer/ca-bundle

Commits
-------

824bb9e Fix setting certificate locations