djplaner / moodle-mod_bim

A Moodle activity module the provides support for managing/marking individual student blogs hosted on external services.
http://davidtjones.wordpress.com/research/bam-blog-aggregation-management/
7 stars 2 forks source link

Problem with secure server blogs #15

Closed markpea closed 14 years ago

markpea commented 14 years ago

All of our web based systems run from secure server, ie https: I get the following error when I try to use a working RSS feed from a blog on secure Apache:

Could not access the URL Unable to access the URL you provided

https://els.earlham.edu/markpea/weblog/rss/

The error created was cURL error 60: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Please try to change the student blog again. Oh dear.

djplaner commented 14 years ago

G'day Mark,

I can confirm this error with my local installation with BIM. Which suggests it's not a unique problem to your context. This does suggest that the problem is related to how BIM is using Simplepie or curl. I'll have a look at this now.

David.

djplaner commented 14 years ago

Okay, I have a solution, but not a strong explanation for why it works or if there might be negative ramifications. It appears to be ok.

First, the problem isn't with BIM, but how Simplepie is retrieving the information. It uses cURL, which as the error suggests, is where the failure occurs. From some reason cURL is unable to verify the certificate for SSL.

The solution I've come across is, I believe, to tell Simplepie to tell cURL not to worry about this.

What I've done is add the following line at line 7686 of BIM's version of simplepie.inc

 curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, 0);

This comes just after $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL; $fp = curl_init();

which is where Simplepie is initialising curl ready for use.

I've tested it on my instance of BIM and am now able to retrieve the RSS for https://els.earlham.edu/markpea/weblog/rss/ and also https://els.earlham.edu/markpea/weblog/

As an aside, there's no need to give the RSS feed. If your blog system follows convention (the earlham system does), BIM will pick up the location of the feed from your blog's home page.

Mark, does this fix work for you?

David.

markpea commented 14 years ago

David, I haven't tried to apply these changes because I cannot seem to get my Simplepie configuration working properly (at least that's what I think is the problem). BIM does not seem to be using an external Simplepie consistently even though I set bim_rss.php with : require_once($CFG->dirroot.'/lib/simplepie_1.2/simplepie.inc') http://www.earlham.edu/markp/millmiss/index.html#%5b%5bBIM%20problems%20%3A%20more%5d%5d

markpea commented 14 years ago

I have just applied the suggest hack to moodle/lib/simplepie_1.2/simplepie.inc and can report that it does work as you have also found. Cheers!