This is a duplicate of this post, however there was no resolution. After a lot of investigation, I found the following extra information.
Background
When renewing Letsencrypt certificates, we get an error There was an error updating certificate: Decoding error: Syntax error
. We are using FreePBX 14 (although after understanding the issue and reviewing the code I think the issue can be on FreePBX 17+ as well).
Issue
I edited some try…catch… to get the traceback, instead of the neat error message, and here it is:
#0 /var/www/html/admin/libraries/pest/PestJSON.php(162): PestJSON->jsonDecode('
\nFatal...')
#1 /var/www/html/admin/libraries/pest/Pest.php(129): PestJSON->processBody('
\nFatal...')
#2 /var/www/html/admin/modules/certman/Certman.class.php(696): Pest->get('/lechecker.php', Array)
#3 /var/www/html/admin/modules/certman/Certman.class.php(181): FreePBX\modules\Certman->updateLE('debtline.pbx-ho...', Array)
#4 /var/www/html/admin/libraries/BMO/GuiHooks.class.php(290): FreePBX\modules\Certman->doConfigPageInit('certman')
#5 /var/www/html/admin/libraries/BMO/GuiHooks.class.php(252): FreePBX\GuiHooks->doBMOConfigPage('Certman', 'certman')
#6 /var/www/html/admin/config.php(445): FreePBX\GuiHooks->doConfigPageInits('certman', Object(component))
#7 {main}
I then reviewed the code, especially around the “pest” and “mirror1.freepbx.org” part in the function updateLE()
and decided to test. I added a file to /var/www/html/.freepbx-known/test
and checked https://mirror1.freepbx.org/lechecker.php?host=[REDACTED]&path=/.freepbx-known/test&token=test&type=http
and saw the following response:
<br />
<b>Fatal error</b>: Uncaught Error: Class "Pest" not found in /var/www/rework/html/lechecker.php:46
Stack trace:
#0 {main}
thrown in <b>/var/www/rework/html/lechecker.php</b> on line <b>46</b><br />
The https://mirror1.freepbx.org/lechecker.php
script works if there is an error, but ironically not when all is correct. For example, run https://mirror1.freepbx.org/lechecker.php?host=[REDACTED]&path=/.freepbx-known/test&token=test&type=http
from your browser instead of your server.
{
"status": false,
"ip": "[REDACTED]",
"message": "Requested host '[REDACTED]' does not resolve to '[REDACTED]' (Resolved to '[REDACTED]' instead)"
}
The error Decoding error: Syntax error
now makes sense, because it is trying to convert the response to JSON, but can’t do it because the lechecker.php
script hosted by FreePBX is returning a traceback.
Conclusion
Is it safe to conlude that there is something wrong on https://mirror1.freepbx.org/lechecker.php
? And that this affects all FreePBX installations?