Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to support RHEL legacy crypto policy #14201

Open
wheakerd opened this issue May 11, 2024 · 11 comments
Open

Update tests to support RHEL legacy crypto policy #14201

wheakerd opened this issue May 11, 2024 · 11 comments

Comments

@wheakerd
Copy link

wheakerd commented May 11, 2024

No description provided.

@remicollet
Copy link
Member

On RHEL/CentOS you need to allow legacy crypto algo

Try using
update-crypto-policies --set LEGACY

@micfogas
Copy link

I'm experiencing this issue compiling PHP on origin/PHP-8.4 branch, AlmaLinux 9.5, gcc 11, OpenSSL 3.2.2-4. Not sure whether to open a new issue or not.

Is enabling legacy ciphers just a temporary workaround or does the OpenSSL PHP extension only support legacy ciphers by design? Let me know if my issue is different please and I'll create a new issue.

My openssl-related errors (my error log includes my full error list, which relate to phar and ipv6 multicast:
`
FAILED TEST SUMMARY

openssl_*() with OPENSSL_KEYTYPE_EC for ec custom params [ext/openssl/tests/ecc_custom_params.phpt]
openssl_x509_verify() tests [ext/openssl/tests/openssl_x509_verify.phpt]
Capture SSL session meta array in stream context [ext/openssl/tests/session_meta_capture.phpt]
Basic bitwise stream crypto context flag assignment [ext/openssl/tests/stream_crypto_flags_001.phpt]
TLSv1.1 and TLSv1.2 bitwise stream crypto flag assignment [ext/openssl/tests/stream_crypto_flags_002.phpt]
Server bitwise stream crypto flag assignment [ext/openssl/tests/stream_crypto_flags_003.phpt]
Specific protocol method specification [ext/openssl/tests/stream_crypto_flags_004.phpt]
tls stream wrapper with min version 1.0 and max version 1.1 [ext/openssl/tests/tls_min_v1.0_max_v1.1_wrapper.phpt]
tls stream wrapper [ext/openssl/tests/tls_wrapper.phpt]
tls stream wrapper when TLS 1.3 available [ext/openssl/tests/tls_wrapper_with_tls_v1.3.phpt]
tlsv1.0 stream wrapper [ext/openssl/tests/tlsv1.0_wrapper.phpt]
tlsv1.1 stream wrapper [ext/openssl/tests/tlsv1.1_wrapper.phpt]
`

My error log: php_test_results_20241220_2227.txt
My config.log:
config.log

You'll notice I'm linking openssl PHP extension statically. I'm also building for lsapi. (litespeed sapi). Please let know what additional info I can provide or whether to open a new issue.

On a side note, is this possibly an OpenSSL 3.2 issue? I'd actually like to build quictls's OpenSSL fork (it's separate from the main quictls fork and is a limited hybrid version of quictls that adds quic+http/3 API support while maintaining OpenSSL drop-in compatibility) quictls/openssl. They provide branches for openssl 3.0, 3.1, and 3.3 branches. Not 3.2. if the problem is a 3.2 issue, I'm fine with building either the quictls openssl forks or an official openssl branch.

I'm linking openssl statically anyway so if there's a specific branch recommended for PHP 8.4 dev, I don't need to worry about breakage.

If there are recommended build flags for building openssl for PHP, please advise. I haven't come across any, but I doubt many people build openssl from source just for PHP. Thanks!

@remicollet
Copy link
Member

FAIL openssl_ * with OPENSSL_KEYTYPE.EC for ec custom params [tests/ecc_custom_params. phpt]

This one is expected to fail.
See discussion on https://bugzilla.redhat.com/show_bug.cgi?id=2223953

Distro packages (8.3 is in CentOS Stream 9 and 10) even include a patch to warn about this
https://gitlab.com/redhat/centos-stream/rpms/php/-/blob/c10s/php-8.3.0-openssl-ec-param.patch?ref_type=heads

Is enabling legacy ciphers just a temporary workaround or does the OpenSSL PHP extension only support legacy ciphers by design?

This is a workaround, the problem is not in the extension but in tests using legacy ciphers.
A lot of tests are already fixed, but a few remain.

I'd actually like to build quictls's OpenSSL fork

I strongly recommend that you not do this, except if you want to rebuild the whole distro.
Building PHP with one lib, but using libs (ex libcurl) built with the other will raise very strange results (both OpenSSL and its fork loaded in memory), Segaults are expected.

@remicollet
Copy link
Member

remicollet commented Dec 21, 2024

For my curiosity, what benefit do you expect building from sources instead of using the distribution packages used by thousands.

My repo is also an alternative if you are not enough patient for new versions or need more SAPI/extensions.
(for memory RPMs are developed in "remi", then go in Fedora, then in CentOS Stream, and later in RHEL and its forks)

@bukka
Copy link
Member

bukka commented Dec 21, 2024

As noted, this is not a PHP core issue so closing.

@bukka bukka closed this as completed Dec 21, 2024
@bukka
Copy link
Member

bukka commented Dec 21, 2024

But I would be open to accept patch to checks the custom curve support and disable it if not supported. It would be even nicer if there was such option (macro) in OpenSSL so it can be easily identified.

@bukka
Copy link
Member

bukka commented Dec 21, 2024

Actually there's still one:

FAIL Bug # 65538: SSL context "cache" disallows URL stream wrappers [tests/bug65538:002. phpt]

So might be better to keep it open or a bit longer. What's the actual output of that one?

@bukka bukka reopened this Dec 21, 2024
@bukka
Copy link
Member

bukka commented Dec 21, 2024

We should probably keep it open for the legacy tests that might need updating or at least there should be some better skipping done.

@bukka bukka changed the title PHP 8.3.7 compiles dynamic extension openssl error Update tests to support RHEL legacy crypto policy Dec 21, 2024
@bukka
Copy link
Member

bukka commented Jan 19, 2025

As I mentioned in my last comment, we should keep this open as some test improvements should be done.

@bukka bukka reopened this Jan 19, 2025
@bukka bukka marked this as a duplicate of #17566 Jan 31, 2025
@bukka
Copy link
Member

bukka commented Feb 6, 2025

I have been looking into this and openssl_x509_verify one is most likely because of the cert with sha1WithRSAEncryption signature, we should use generated cert for this so this should be easy.

phar ones are using also SHA1 and even MD5 so they are failing because of that.

The EC one could be identified during the configuration so we could just disable the function and maybe expose some constant for user space so it can skip it. It would be nice to have upstream support to disable it in OpenSSL so it can be just taken from OpenSSL but that wouldn't be available immediately anyway.

The TLS one are related to the used system_default section in openssl.cnf selected by the policy. It adds some limitations. I need to look into this more to see if we can somehow retrieve the needed info from the SSL_CTX (there are accessors for levels but we would need probably some extra API for that. Alternatively it might be enough to get it from errors and then skip accordingly.

And lastly the failure in mcast_ipv6_recv.phpt is a bit mistery. It should not be related OpenSSL though. I will see if I can recreate it.

I tried to update my old laptop to Fedora 41 but it somehow crashed so need to reformat it and see if I can get the fresh install or the laptop is gone. If it's gone, I will get the compilation option for OpenSSL and try it locally on my main machine and see if I can recreate everything. I will then create issues for each of the above.

@bukka
Copy link
Member

bukka commented Feb 28, 2025

Just FYI, the openssl_x509_verify part should be now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants