Error after upgrade to 22.7.3

Started by seed, September 01, 2022, 04:07:58 PM

Previous topic - Next topic
This is the error i got.
The ACME plugin and OpenVPN Server is not starting anymore.

PHP Errors:

[01-Sep-2022 16:04:21 Europe/Berlin] PHP Fatal error:  Uncaught phpseclib3\Exception\UnsupportedAlgorithmException: Signature algorithm unsupported in /usr/local/share/phpseclib/File/X509.php:1455
Stack trace:
#0 /usr/local/share/phpseclib/File/X509.php(1412): phpseclib3\File\X509->validateSignatureHelper('rsaEncryption', '-----BEGIN PUBL...', 'id-RSASSA-PSS', '\xA7\xB5[\x84=k\xC2\xD6\x14\x0F(\xA1\xD4r\xE4...', '0\x81\x970\v\x06\t*\x86H\x86\xF7\r\x01\x01...')
#1 /usr/local/share/phpseclib/File/X509.php(1286): phpseclib3\File\X509->validateSignatureCountable(false, 0)
#2 /usr/local/etc/inc/certs.inc(680): phpseclib3\File\X509->validateSignature(false)
#3 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(834): crl_update(Array)
#4 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(1115): openvpn_reconfigure('server', Array)
#5 /usr/local/etc/inc/util.inc(166): openvpn_configure_single('1')
#6 /usr/local/www/status_services.php(43): service_control_start('openvpn', Array)
#7 {main}
  thrown in /usr/local/share/phpseclib/File/X509.php on line 1455
[01-Sep-2022 16:04:29 Europe/Berlin] PHP Fatal error:  Uncaught phpseclib3\Exception\UnsupportedAlgorithmException: Signature algorithm unsupported in /usr/local/share/phpseclib/File/X509.php:1455
Stack trace:
#0 /usr/local/share/phpseclib/File/X509.php(1412): phpseclib3\File\X509->validateSignatureHelper('rsaEncryption', '-----BEGIN PUBL...', 'id-RSASSA-PSS', '\xB2\x1C%\xFD\xA0\x13\x05\xAA\xD3\xF1\x86"\x06v\xA3...', '0\x81\x970\v\x06\t*\x86H\x86\xF7\r\x01\x01...')
#1 /usr/local/share/phpseclib/File/X509.php(1286): phpseclib3\File\X509->validateSignatureCountable(false, 0)
#2 /usr/local/etc/inc/certs.inc(680): phpseclib3\File\X509->validateSignature(false)
#3 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(834): crl_update(Array)
#4 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(1115): openvpn_reconfigure('server', Array)
#5 /usr/local/etc/inc/util.inc(166): openvpn_configure_single('1')
#6 /usr/local/www/status_services.php(43): service_control_start('openvpn', Array)
#7 {main}
  thrown in /usr/local/share/phpseclib/File/X509.php on line 1455
[01-Sep-2022 16:05:17 Europe/Berlin] PHP Fatal error:  Uncaught phpseclib3\Exception\UnsupportedAlgorithmException: Signature algorithm unsupported in /usr/local/share/phpseclib/File/X509.php:1455
Stack trace:
#0 /usr/local/share/phpseclib/File/X509.php(1412): phpseclib3\File\X509->validateSignatureHelper('rsaEncryption', '-----BEGIN PUBL...', 'id-RSASSA-PSS', 'l\xC9\xD3\x9A\xD7\xF0\xFB\xB7\xF5cn`\x17h\xAD...', '0\x81\x970\v\x06\t*\x86H\x86\xF7\r\x01\x01...')
#1 /usr/local/share/phpseclib/File/X509.php(1286): phpseclib3\File\X509->validateSignatureCountable(false, 0)
#2 /usr/local/etc/inc/certs.inc(680): phpseclib3\File\X509->validateSignature(false)
#3 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(834): crl_update(Array)
#4 /usr/local/etc/inc/plugins.inc.d/openvpn.inc(1115): openvpn_reconfigure('server', Array)
#5 /usr/local/etc/inc/util.inc(166): openvpn_configure_single('1')
#6 /usr/local/www/status_services.php(43): service_control_start('openvpn', Array)
#7 {main}
  thrown in /usr/local/share/phpseclib/File/X509.php on line 1455
i want all services to run with wirespeed and therefore run this dedicated hardware configuration:

AMD Ryzen 7 9700x
ASUS Pro B650M-CT-CSM
64GB DDR5 ECC (2x KSM56E46BD8KM-32HA)
Intel XL710-BM1
Intel i350-T4
2x SSD with ZFS mirror
PiKVM for remote maintenance

private user, no business use

22.7.3 broke my primary FW, boots, but does not work. So something is really off with it.
But I saw error messages simillar to yours

i assume this issue is caused by something crl related. once i removed the CRL from my openvpn config openvpn starts again.
i want all services to run with wirespeed and therefore run this dedicated hardware configuration:

AMD Ryzen 7 9700x
ASUS Pro B650M-CT-CSM
64GB DDR5 ECC (2x KSM56E46BD8KM-32HA)
Intel XL710-BM1
Intel i350-T4
2x SSD with ZFS mirror
PiKVM for remote maintenance

private user, no business use

EC in but RSA-PSS out? Feels like playing whac-a-mole.

We will look into this tomorrow.

And please don't cross-post "mine is broken" to a detailed report. Thanks. ;)


Cheers,
Franco

According to phpseclib this is the relevant bit:

https://github.com/phpseclib/phpseclib/blob/2f0b7af658cbea265cbb4a791d6c29a6613f98ef/phpseclib/File/X509.php#L1434-L1457

This indicates the first element of validateSignatureHelper() should be "id-RSASSA-PSS" but it actually is "rsaEncryption". I'm not sure which is correct, but as far as I know PSS is for signature only so this may be wrong in the library code?


Cheers,
Franco

September 01, 2022, 04:43:18 PM #5 Last Edit: September 01, 2022, 04:47:18 PM by athurdent
Failed here, too. Had to revert my VM snapshot
First screenshot shows a sync error right before reboot I never had. Also not when turning it off 1 minute before on the older version to take a snapshot.
Second screenshot shows where it's stuck after the reboot.

Pulled update for now, patch likely going to be https://github.com/opnsense/core/commit/3b39e2d1f6 but this is fishy library handling as the certificate in question seemed to work. It's imported, but no complaints before, especially not pre-phpseclib when we had "native" CLR patching in PHP 7.


Cheers,
Franco

Quote from: franco on September 01, 2022, 04:56:59 PM
Pulled update for now, patch likely going to be https://github.com/opnsense/core/commit/3b39e2d1f6 but this is fishy library handling as the certificate in question seemed to work. It's imported, but no complaints before, especially not pre-phpseclib when we had "native" CLR patching in PHP 7.

Did this cause:

Checking packages: ........................
opnsense-22.7.3 version mismatch, expected 22.7.2
Checking packages: ..
opnsense-lang-22.7.3 version mismatch, expected 22.7.1
Checking packages: .
opnsense-update-22.7.3 version mismatch, expected 22.7.2
Checking packages: .............
php80-phpseclib-3.0.14 version mismatch, expected 2.0.37
Checking packages: ......................... done
***DONE***


Apart from that I experienced no issues after the upgrade.

September 01, 2022, 05:50:28 PM #8 Last Edit: September 01, 2022, 06:16:22 PM by Fright
@franco
how stupid is my idea?:
phpseclib3  shifted the paradigm a bit (https://github.com/phpseclib/phpseclib/issues/1522) and now you have to read the public key, take the signature algorithm from there and explicitly specify it ($ca_cert = $ca_cert->withHash($pub_key_sign_algo);) before signing (otherwise the library will force PSS ("It's doing PSS, as is, because PSS is th default padding scheme that RSA keys utilize") and create a "broken" CRL)

@i81b4u looks normal since you caught the 22.7.3 and it insists on having lower packages when mirror wants to publish 22.7.2 again.

@Fright before working around phpseclib let's first generate a test certificate for this behaviour and then try to fix phpseclib itself. The validation may be off here / trying to enforce something it doesn't have to: the code checks $publicKeyAlgorithm but never checks $signatureAlgorithm in PSS case assuming it's correct. If it just checked $signatureAlgorithm and ignore $publicKeyAlgorithm it might just start working and we can discuss with upstream.


Cheers,
Franco

Back online as 22.7.3_2.


Cheers,
Franco

Thank you for the very quick response.
In the meantime, I had reinstalled my firewall and upgraded to 22.7.2.

I have now tested the update again and could not find any errors on my system.
i want all services to run with wirespeed and therefore run this dedicated hardware configuration:

AMD Ryzen 7 9700x
ASUS Pro B650M-CT-CSM
64GB DDR5 ECC (2x KSM56E46BD8KM-32HA)
Intel XL710-BM1
Intel i350-T4
2x SSD with ZFS mirror
PiKVM for remote maintenance

private user, no business use

September 02, 2022, 05:21:48 PM #12 Last Edit: September 02, 2022, 07:25:23 PM by Fright
sorry. a little confused.
so is it fixed?
(imho it does not look like this and there are upstream issues  .. or i missed some?)

@franco
Hi.
As far as I can understand, the problem has not been solved yet. And I think it's in the phpseclib validateSignatureHelper()  function. Does this make sense in your opinion?
https://github.com/kulikov-a/phpseclib/commit/bf4487c504ea5ea2c36ec7cd0e01fed05b41a6fd

I continue testing, but the CRLs of internal CAs (RSA and EC) works with these.
I will check on various imported CA

Patch looks sane to me, better than the other convoluted approach. There is the issue of trying to limit EC stuff to EC keys for example but the key should be loaded regardless and it could return early if the key cannot be loaded?


Cheers,
Franco