Bug #64666 [Fbk->NoF]: Certificate not captured if present, but CN_match fails
| From: | php-bugs at lists dot php dot net | Date: | Sun, 13 Jun 2021 04:22:13 +0000 |
| Subject: | Bug #64666 [Fbk->NoF]: Certificate not captured if present, but CN_match fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234381@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64666&edit=1
ID: 64666
Updated by: php-bugs@lists.php.net
Reported by: douglas dot wright at pre-school dot org dot uk
Summary: Certificate not captured if present, but CN_match
fails
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Streams related
Operating System: Windows 7
PHP Version: 5.4.14
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-06-02 11:06:09] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2013-04-18 11:37:46] douglas dot wright at pre-school dot org dot uk
Description:
------------
If connecting to a server that has a certificate that doesn't match the expected hostname, then
the certificate is not captured. For logging/troubleshooting purposes this should still work.
Test script:
---------------
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
foreach (['www.pre-school.org.uk', 'www.pre-school.org'] as $cn) {
echo "Testing {$cn} against www.pre-school.org.uk...";
$context = stream_context_create(['ssl' => ['SNI_enabled' =>
true,
'verify_peer' => true,
'CN_match' => $cn,
'cafile' =>
'keys/Mozilla-Cert-Bundle.pem',
'capture_peer_cert' => true,
'capture_peer_cert_chain' => true]]);
$conn = stream_socket_client("tcp://www.pre-school.org.uk:443", $errNo, $errStr, 5,
STREAM_CLIENT_CONNECT, $context);
@stream_socket_enable_crypto($conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
echo isset(stream_context_get_options($conn)["ssl"]["peer_certificate"]) ?
"captured\r\n" : "NOT captured\r\n";
}
Expected result:
----------------
Certificate captured under both success and failure
Actual result:
--------------
Certificate captured under success only
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64666&edit=1