Permalink
Browse files

MDL-36903 Make mdeploy.php use the custom CA certificate if it exists

  • Loading branch information...
mudrd8mz committed Nov 30, 2012
1 parent 30e2682 commit e428b5e0aec45e874862c62ca39c2c482ed77a7d
Showing with 9 additions and 0 deletions.
  1. +9 −0 mdeploy.php
View
@@ -967,6 +967,15 @@ protected function download_file($source, $target) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); // nah, moodle.org is never unavailable! :-p
curl_setopt($ch, CURLOPT_URL, $source);
+ $dataroot = $this->input->get_option('dataroot');
+ $cacertfile = $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 ZIP provider.
+ $this->log('Using custom CA certificate '.$cacertfile);
+ curl_setopt($ch, CURLOPT_CAINFO, $cacertfile);
+ }
+
$targetfile = fopen($target, 'w');
if (!$targetfile) {

0 comments on commit e428b5e

Please sign in to comment.