MDL-39356 add ca certificate bundles for cURL
This is necessary because PHP in Windows does not have any certificates and some *nix systems have outdated or missing ca bundles too. The order is: 1/ dataroot/moodleorgca.crt always wins - needs to be added manually by admin 2/ php.ini setting "curl.cainfo" is next 3/ on Windows libdir/cacert.pem is used because it does not have any default cert bundles 4/ system default is the last - the previous value, ok for properly configured *nix systems
This commit is contained in:
@@ -1429,13 +1429,6 @@ class available_update_checker {
|
||||
'CURLOPT_SSL_VERIFYPEER' => true,
|
||||
);
|
||||
|
||||
$cacertfile = $CFG->dataroot.'/moodleorgca.crt';
|
||||
if (is_readable($cacertfile)) {
|
||||
// Do not use CA certs provided by the operating system. Instead,
|
||||
// use this CA cert to verify the updates provider.
|
||||
$options['CURLOPT_CAINFO'] = $cacertfile;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -2318,13 +2311,6 @@ class available_update_deployer {
|
||||
'CURLOPT_SSL_VERIFYPEER' => true,
|
||||
);
|
||||
|
||||
$cacertfile = $CFG->dataroot.'/moodleorgca.crt';
|
||||
if (is_readable($cacertfile)) {
|
||||
// Do not use CA certs provided by the operating system. Instead,
|
||||
// use this CA cert to verify the updates provider.
|
||||
$curloptions['CURLOPT_CAINFO'] = $cacertfile;
|
||||
}
|
||||
|
||||
$curl = new curl(array('proxy' => true));
|
||||
$result = $curl->head($downloadurl, $curloptions);
|
||||
$errno = $curl->get_errno();
|
||||
|
||||
Reference in New Issue
Block a user