mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #48577
[Bug 1773864] Re: ExternalFeed block cron task fails when SSL cert is not valid for a feed
To reproduce:
* Create a page
* Add External Feed:
** Feed Location = http://www.safeworkaustralia.gov.au/sites/SWA/mediafeed (at time of post)
** Insecure SSL mode = No
** Save
These other feeds were causing issues at time of this post:
* http://www.safeworkaustralia.gov.au/sites/SWA/publicationfeed
* http://www.safeworkaustralia.gov.au/sites/SWA/newsfeed
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";
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1773864
Title:
ExternalFeed block cron task fails when SSL cert is not valid for a
feed
Status in Mahara:
New
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.php::mahara_http_request() from
blocktype/externalfeed/lib.php::parse_feed()
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/mahara/htdocs/lib/errors.php:95
* log_warn("Curl error: 60: SSL certificate problem: unable to...") at /var/www/mahara/htdocs/lib/web.php:4425
* mahara_http_request(array(size 3), false) at /var/www/mahara/htdocs/blocktype/externalfeed/lib.php:421
* PluginBlocktypeExternalfeed::parse_feed("http://www.safeworkaustralia.gov.au/sites/SWA/medi...", "0", "", "********") at /var/www/mahara/htdocs/blocktype/externalfeed/lib.php:336
* PluginBlocktypeExternalfeed::refresh_feeds() at /var/www/mahara/htdocs/lib/mahara.php:1809
* call_static_method("PluginBlocktypeExternalfeed", "refresh_feeds") at /var/www/mahara/htdocs/lib/cron.php:115
[WAR] 63 (blocktype/externalfeed/lib.php:336) error in /blocktype/externalfeed/lib.php line 428. error:SSL certificate problem: unable to get local issuer certificate
[WAR] 63 (lib/errors.php:536) [Error]: Wrong parameters for MaharaException([string $message [, long $code [, Throwable $previous = NULL]]])
Call stack (most recent first):
* exception(object(Error)) at Unknown:0
I had added extra debugging statements to see the error:
[WAR] 63 (blocktype/externalfeed/lib.php:336) error in
/blocktype/externalfeed/lib.php line 428. error:SSL certificate
problem: unable to get local issuer certificate
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.php:536) [Error]: Wrong parameters for
MaharaException([string $message [, long $code [, Throwable $previous
= NULL]]])
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1773864/+subscriptions
References