RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1408301 - php openssl extension does not work with non-default crypto engines
Summary: php openssl extension does not work with non-default crypto engines
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: php
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: ---
Assignee: Remi Collet
QA Contact: David Jež
URL:
Whiteboard:
Depends On:
Blocks: 1420851 1549616 1562205
TreeView+ depends on / blocked
 
Reported: 2016-12-22 20:14 UTC by David Mulford
Modified: 2021-12-10 14:51 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:26:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch containing addition of OPENSSL_config() function (525 bytes, patch)
2016-12-22 20:14 UTC, David Mulford
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3228 0 None None None 2018-10-30 11:26:16 UTC

Description David Mulford 2016-12-22 20:14:56 UTC
Created attachment 1234879 [details]
Patch containing addition of OPENSSL_config() function

Description of problem:
PHP openssl extension ignores OpenSSL configuration files. It doesn't read neither the default /etc/pki/tls/openssl.cnf file, nor does it honour the OPENSSL_CONF environment variable. 

Customers using a non-default openssl engine (like GOST) are using the openssl.cnf file to enable this in the openssl extension. The fact that PHP ignores /etc/pki/tls/openssl.cnf (or any other custom OpenSSL file) makes it impossible to use GOST cipher in PHP code as well as any other non-default OpenSSL engines and ciphers.

Looking at source in php-5.4.16/ext/openssl/openssl.c reveals that PHP doesn't invoke OPENSSL_config(), that's why configuration files are not loaded.

Version-Release number of selected component (if applicable):
* php-5.4.16-42.el7
* RHEL 7.3

How reproducible:
Always

Additional info:
A customer has given the attached patch which calls the OPENSSL_config() function, and has asked for the inclusion of this in RHEL 7.3.

Comment 2 Remi Collet 2017-07-13 09:09:49 UTC
PHP don't use OPENSSL_init, but load configuration file using the CONF_load() function instead.

Configuration can be set per environment OPENSSL_CONF or in code using the "config" option is lot of functions call.

Test using upstream test case:
http://git.php.net/?p=php-src.git;a=blob_plain;f=ext/openssl/tests/021.phpt;h=391b6a5279f99875696a881693f0123c1afc795b;hb=refs/heads/PHP-5.4.16


$ strace php 021.phpt 2>&1 | grep openssl.cnf
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/etc/pki/tls/openssl.cnf", O_RDONLY) = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3

Both system and test configuration files are used

$ cp /etc/pki/tls/openssl.cnf /tmp
$ export OPENSSL_CONF=/tmp/openssl.cnf
$ strace php 021.phpt 2>&1 | grep openssl.cnf
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3
open("/tmp/openssl.cnf", O_RDONLY)      = 3
open("/home/remi/php-5.4.16/ext/openssl/tests/openssl.cnf", O_RDONLY) = 3

Both system redirected and test configuration files are used

Comment 5 Remi Collet 2017-08-24 09:33:49 UTC
PR open to raise discussion with upstream maintainer
https://github.com/php/php-src/pull/2706

Comment 15 errata-xmlrpc 2018-10-30 11:26:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3228


Note You need to log in before you can comment on or make changes to this bug.