Skip to content

Instantly share code, notes, and snippets.

@ad-m
Last active July 11, 2017 21:45
Show Gist options
  • Select an option

  • Save ad-m/8e88a9529518a3209d213ee17e8b7e97 to your computer and use it in GitHub Desktop.

Select an option

Save ad-m/8e88a9529518a3209d213ee17e8b7e97 to your computer and use it in GitHub Desktop.
Current PHP version: 7.0.18-0ubuntu0.16.04.1
<pre>
OK ssl://s50.hekko.pl:465 ssl://s50.hekko.pl:465
OK ssl://s50.hekko.pl:993 ssl://s50.hekko.pl:993
PHP Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://s50.hekko.pl:443 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://s50.hekko.pl:443 (0)
PHP Warning: stream_socket_client(): Peer certificate CN=`*.hekko.pl' did not match expected CN=`mail.siecobywatelska.pl' in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://mail.siecobywatelska.pl:465 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://mail.siecobywatelska.pl:465 (0)
PHP Warning: stream_socket_client(): Peer certificate CN=`*.hekko.pl' did not match expected CN=`mail.siecobywatelska.pl' in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://mail.siecobywatelska.pl:993 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://mail.siecobywatelska.pl:993 (0)
OK ssl://mail.siecobywatelska.pl:443 ssl://mail.siecobywatelska.pl:443
PHP Warning: stream_socket_client(): Peer certificate CN=`*.hekko.pl' did not match expected CN=`s50.hekko.net.pl' in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://s50.hekko.net.pl:465 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://s50.hekko.net.pl:465 (0)
PHP Warning: stream_socket_client(): Peer certificate CN=`*.hekko.pl' did not match expected CN=`s50.hekko.net.pl' in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://s50.hekko.net.pl:993 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://s50.hekko.net.pl:993 (0)
PHP Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): Failed to enable crypto in /tmp/test.php on line 15
PHP Warning: stream_socket_client(): unable to connect to ssl://s50.hekko.net.pl:443 (Unknown error) in /tmp/test.php on line 15
FAIL ssl://s50.hekko.net.pl:443 (0)
</pre>
Current PHP version: 5.5.37
<pre>
FAIL ssl://s50.hekko.pl:465 (0)
FAIL ssl://s50.hekko.pl:993 (0)
FAIL ssl://s50.hekko.pl:443 (0)
FAIL ssl://mail.siecobywatelska.pl:465 (0)
FAIL ssl://mail.siecobywatelska.pl:993 (0)
FAIL ssl://mail.siecobywatelska.pl:443 (0)
FAIL ssl://s50.hekko.net.pl:465 (0)
FAIL ssl://s50.hekko.net.pl:993 (0)
FAIL ssl://s50.hekko.net.pl:443 (0)
</pre>
<?php
echo 'Current PHP version: ' . phpversion()."\n";
error_reporting(E_ALL);
?>
<pre>
<?php
function test_socket($url){
$opts = array(
'ssl' => array(
'verify_peer' => true,
'verify_peer_name' => true,
));
$context = stream_context_create($opts);
$fp = stream_socket_client($url, $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $context);
if (!$fp) {
echo "FAIL\t$url\t$errstr ($errno)\n";
}else{
echo "OK\t$url\t$url\n";
};
};
foreach (['s50.hekko.pl', 'mail.siecobywatelska.pl', 's50.hekko.net.pl'] as $host) {
foreach (['465','993','443'] as $port) {
test_socket("ssl://${host}:${port}");
};
}
?>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment