Mediawiki Scary Transclusion and SSL Self Signed Certificate
Mediawiki 1.26, Ubuntu 16.04.1.
Scary transclusion ($wgEnableScaryTranscluding) stopped working when we moved Wikis to HTTPS only. Were getting error scarytranscludefailed ("[Template fetch failed for $1]").
Turned out being that we are using self signed certificates.
Had to dive into includes/parser/Parser.php, function fetchScaryTemplateMaybeFromCache, and var_dump($status) after line 4125 to understand what was going on:
object(Status)#405 (6) {
["sv":protected]=>
object(StatusValue)#403 (6) {
["ok":protected]=>
bool(false)
["errors":protected]=>
array(1) {
[0]=>
array(3) {
["type"]=>
string(5) "error"
["message"]=>
string(15) "http-curl-error"
["params"]=>
array(1) {
[0]=>
string(113) "error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs"
}
}
}
After importing the certificate into /etc/ssl/certs/ca-certificates.crt it began working again.
openssl s_client -showcerts -connect domain:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
sudo su
cat mycertfile.pem >>/etc/ssl/certs/ca-certificates.crt
Remember to set $wgTranscludeCacheExpiry = 0 during tests, or the cache will drive you mad.
(Comment added to $wgEnableScaryTranscluding discussion page).
Comments
Post a Comment