note 115405 added to function.fsockopen
| From: | p14nd4 | Date: | Fri, 18 Jul 2014 21:30:02 +0000 |
| Subject: | note 115405 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199973@lists.php.net to get a copy of this message | ||
It appears that in PHP 5.6.0 (at least the version in Debian jessie, with openssl 1.0.1h-3), this
function *is* now validating SSL certificates (in a variety of ways). First, it appears to fail for
untrusted certificates (i.e. no matching CA trusted locally), and secondly, it appears to fail for
mismatched hostnames in the request and certificate.
---------
$ echo "<?php echo fsockopen(\"ssl://localhost\", 993); ?>" | php -a
Interactive mode enabled
PHP Warning: fsockopen(): Peer certificate CN=
my.test.server' did not match expected
CN=localhost' in - on line 1
PHP Warning: fsockopen(): Failed to enable crypto in - on line 1
PHP Warning: fsockopen(): unable to connect to ssl://localhost:993 (Unknown error) in - on line 1
----------
$ echo "<?php echo fsockopen(\"ssl://my.test.server\", 993); ?>" | php -a
Interactive mode enabled
PHP Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in - on line 1
PHP Warning: fsockopen(): Failed to enable crypto in - on line 1
PHP Warning: fsockopen(): unable to connect to ssl://my.test.server:993 (Unknown error) in - on
line 1
---------
#installed CA locally
---------
$ echo "<?php echo fsockopen(\"ssl://my.test.server\", 993); ?>" | php -a
Interactive mode enabled
Resource id #1
----
Server IP: 216.194.115.244
Probable Submitter: 173.11.59.193
----
Manual Page -- http://php.net/manual/en/function.fsockopen.php
Edit -- https://master.php.net/note/edit/115405
Del: integrated -- https://master.php.net/note/delete/115405/integrated
Del: useless -- https://master.php.net/note/delete/115405/useless
Del: bad code -- https://master.php.net/note/delete/115405/bad+code
Del: spam -- https://master.php.net/note/delete/115405/spam
Del: non-english -- https://master.php.net/note/delete/115405/non-english
Del: in docs -- https://master.php.net/note/delete/115405/in+docs
Del: other reasons-- https://master.php.net/note/delete/115405
Reject -- https://master.php.net/note/reject/115405
Search -- https://master.php.net/manage/user-notes.php