php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72235 PDO and certificate CN
Submitted: 2016-05-18 01:42 UTC Modified: 2016-05-18 02:02 UTC
From: ghfjdksl at gmail dot com Assigned:
Status: Duplicate Package: PDO MySQL
PHP Version: 5.6.21 OS: rhel 6.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 - 21 = ?
Subscribe to this entry?

 
 [2016-05-18 01:42 UTC] ghfjdksl at gmail dot com
Description:
------------
In php 5.6, certificate CN is verified by default. But this is infeasible in some situation. There should be at least one attribute that can toggle the CN verification on and off, or at least let the user specify what the expected CN is, instead of using the connection url. There is a flag that one can set for mysqli, but there is no such option for PDO now.


Test script:
---------------
<?php
$attr[PDO::MYSQL_ATTR_SSL_CA] = "rootCA.pem";
//$attr[PDO::MYSQL_ATTR_SSL_SERVER_CN] = "the.real.server.cn";
try
{
    $conn = new PDO("mysql:host=server.ip.here;port=3306;","test_user", "my_password", $attr);
}
catch (Exception $e)
{
    print "not ok\n";
    throw $e;
}
print "ok of no exception\n"
?>

Expected result:
----------------
The test script requires mysql to be correctly setup to use ssl connection. I'm only posting the client code here. And I'm hiding my real test ip. 
Server certificate have CN "the.real.server.cn", and connection ip is some real ip address. Since these two are different, the connection should fail.
After the attached patch, one can uncomment the PDO::MYSQL_ATTR_SSL_SERVER_CN line, and the connection should succeed.


Patches

add_PDO_SPECIFY_CN (last revision 2016-05-18 01:43 UTC by ghfjdksl at gmail dot com)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-18 02:02 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2016-05-18 02:02 UTC] requinix@php.net
Duplicate of bug #71845 and related to request #71003.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:28 2024 UTC