Bug #76714 [NEW]: Collision between MySQL SSL connection and OpenSSL create key
| From: | michel at ingenie dot fr | Date: | Tue, 07 Aug 2018 07:28:38 +0000 |
| Subject: | Bug #76714 [NEW]: Collision between MySQL SSL connection and OpenSSL create key | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-216654@lists.php.net to get a copy of this message | ||
From: michel at ingenie dot fr
Operating system: ubuntu 16.04
PHP version: 7.0.31
Package: MySQLi related
Bug Type: Bug
Bug description:Collision between MySQL SSL connection and OpenSSL create key
Description:
------------
When using SSL connection with mysqli, the use of openssl function to
create a key disrupt the mysqli connection.
Many thanks for your attention.
Test script:
---------------
<?php
$mysqli = new mysqli();
$mysqli->ssl_set('/etc/mysql/ssl/client-key.pem','/etc/mysql/ssl/client-cert.pem','/etc/mysql/ssl/ca-cert.pem',null,null);
$mysqli->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT,false);
$mysqli->real_connect('remote.host.com','login','password',null,null,null,MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT);
// test SQL query : WORK FINE
$mysqli->select_db('test');
$result = $mysqli->query('select * from test');
print_r($result->fetch_all());
// Create KEY
$key = openssl_pkey_new(['digest_alg' =>
'sha256','private_key_bits' =>
1024,'private_key_type' => OPENSSL_KEYTYPE_RSA]);
// test SQL query : FAIL
$mysqli->select_db('test'); // this is line 19
$result = $mysqli->query('select * from test');
print_r($result->fetch_all());
Expected result:
----------------
Just a dump of returned array like for the first select.
Actual result:
--------------
PHP Warning: mysqli::select_db(): SSL operation failed with code 1.
OpenSSL Error messages:
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value in
.../test_bug_mysql_ssl_openssl.php on line 19
Warning: mysqli::select_db(): SSL operation failed with code 1. OpenSSL
Error messages:
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value
error:0E06D06C:configuration file routines:NCONF_get_string:no value in
.../test_bug_mysql_ssl_openssl.php on line 19
PHP Warning: mysqli::select_db(): MySQL server has gone away in
.../test_bug_mysql_ssl_openssl.php on line 19
Warning: mysqli::select_db(): MySQL server has gone away in
.../test_bug_mysql_ssl_openssl.php on line 19
PHP Warning: mysqli::select_db(): Error while reading INIT_DB's OK
packet. PID=16092 in .../test_bug_mysql_ssl_openssl.php on line 19
Warning: mysqli::select_db(): Error while reading INIT_DB's OK packet.
PID=16092 in .../test_bug_mysql_ssl_openssl.php on line 19
PHP Fatal error: Uncaught Error: Call to a member function fetch_all()
on boolean in .../test_bug_mysql_ssl_openssl.php:21
Stack trace:
#0 {main}
thrown in .../test_bug_mysql_ssl_openssl.php on line 21
Fatal error: Uncaught Error: Call to a member function fetch_all() on
boolean in .../test_bug_mysql_ssl_openssl.php:21
Stack trace:
#0 {main}
thrown in .../test_bug_mysql_ssl_openssl.php on line 21
--
Edit bug report at https://bugs.php.net/bug.php?id=76714&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76714&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76714&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76714&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76714&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76714&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76714&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76714&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76714&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76714&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76714&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76714&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76714&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76714&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76714&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76714&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76714&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76714&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76714&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76714&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76714&r=mysqlcfg