FreePBX / framework

This module provides a facility to install bug fixes to the framework code that is not otherwise housed in a module
http://www.freepbx.org
GNU General Public License v3.0
64 stars 64 forks source link

gpg fails to use next keyserver with FAILURE response #137

Closed Stevehans closed 5 months ago

Stevehans commented 5 months ago

FreePBX Version

FreePBX 17

Issue Description

The required keys were not on the first keyserver attempted, but the return didn't match that expected in code "[GNUPG:] NODATA 1", so the key that had not been received was then validated, which failed.

The checks in GPG.class.php/getKey() need to be extended to check for FAILURE as well as NODATA, and potentially the status return?

Operating Environment

17.0.15.27

Relevant log output

[2024-06-20 09:17:26] [freepbx.INFO]: key result: array (   
    'stdout' => '',   
    'stderr' => 'gpg: keyserver receive failed: No data ',   
    'status' =>    array (     0 => '[GNUPG:] FAILURE recv-keys 167772218',   ),   'exitcode' => 2, )
Stevehans commented 5 months ago

gpg (GnuPG) 2.2.40 libgcrypt 1.10.1

Stevehans commented 5 months ago

This seems related to the 2.2 version that is installed as part of the 17 setup, the 2.0 on FreePBX 16 is fine. Just pulling the gpg source so I can see what the error code means

kguptasangoma commented 5 months ago

Hi @Stevehans can you please modify the if condition to add below OR condition as well then let me know if this works for you ? if ((strpos($retarr['status'][0], "[GNUPG:] FAILURE recv-keys") === 0) || ($retarr['status'][0] == "[GNUPG:] NODATA 1")) {

thanks

Stevehans commented 5 months ago

I've done that already on my copy and it's fine. Just checking, looks as though the issue is that 2.2 now uses dirmngr that is returning this status

kguptasangoma commented 5 months ago

okay thanks so i will push this fix which will work for older version of GPG or new too.

Stevehans commented 5 months ago

Perfect, thanks

kguptasangoma commented 5 months ago

framework v17.0.15.28