ExternalFeed block cron task fails when SSL cert is not valid for a feed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
High
|
Ghada El-Zoghbi | ||
17.04 |
Fix Released
|
High
|
Unassigned | ||
17.10 |
Fix Released
|
High
|
Unassigned | ||
18.04 |
Fix Released
|
High
|
Unassigned | ||
18.10 |
Fix Released
|
High
|
Ghada El-Zoghbi |
Bug Description
Mahara: 18.04
OS: Linux
DB: Postgres
Browser: n/a
Cron fails (and is therefore locked) when one of the rss feeds has an invalid ssl certificate.
The cron job calls lib/web.
The following error results:
[WAR] 63 (lib/web.php:4425) Curl error: 60: SSL certificate problem: unable to get local issuer certificate
Call stack (most recent first):
* log_message("Curl error: 60: SSL certificate problem: unable to...", 8, true, true) at /var/www/
* log_warn("Curl error: 60: SSL certificate problem: unable to...") at /var/www/
* mahara_
* PluginBlocktype
* PluginBlocktype
* call_static_
[WAR] 63 (blocktype/
[WAR] 63 (lib/errors.
Call stack (most recent first):
* exception(
I had added extra debugging statements to see the error:
[WAR] 63 (blocktype/
Mahara then raises a MaharaException with the error (SSL certificate problem: unable to get local issuer certificate) as the code. But, it's not an integer so it fails with:
[WAR] 63 (lib/errors.
We need to check if the error coming back is a number or string. If number, pass it as the code in the MaharaException. Otherwise, append it to the text of the error message so the data is not lost.
We found this when upgrading from 17.04 to 18.04. This issue is present in 17.04 as well.
Changed in mahara: | |
assignee: | nobody → Ghada El-Zoghbi (ghada-z) |
Changed in mahara: | |
importance: | Undecided → Medium |
status: | New → In Progress |
milestone: | none → 18.10.0 |
To reproduce:
* Create a page www.safeworkaus tralia. gov.au/ sites/SWA/ mediafeed (at time of post)
* Add External Feed:
** Feed Location = http://
** Insecure SSL mode = No
** Save
These other feeds were causing issues at time of this post:
* http:// www.safeworkaus tralia. gov.au/ sites/SWA/ publicationfeed www.safeworkaus tralia. gov.au/ sites/SWA/ newsfeed
* http://
In the cron log, error should appear and externalfeed cron task should now be locked (when it runs and it's time to refresh the feed).
To speed up testing:
* in blocltype/ externalfeed/ lib.php: :refresh_ feeds - set in the sql query to refresh every 0 minutes (instead of 30 minutes).
* in blocltype/ externalfeed/ lib.php: :parse_ feeds - comment out the 'throw $cache[$source]' and the 'return $cache[$source]' at the top of the function.
* change cron time for the task to run every minute:
update blocktype_cron set minute = '*', nextrun = '2018-05-29 11:54' where callfunction = 'refresh_feeds';
If feeds are now valid, can try to set $result->error after the mahara_ http_request( ) call in the parse_feed() function.
i.e. $result->error = "SSL certificate problem: unable to get local issuer certificate";