Has anyone gotten DBD::MySQL to work with SSL in ActiveState Perl? I am
running Windows XP with the latest patches and ActivePerl 5.12.3 Build 1024.
I used the MySQL guide to create the server and client certificates for the
connections
(http://dev.mysql.com/doc/refman/5.0/en/secure-create-certs.html).  I have
the following code:

use warnings;
use strict;
use DBI;

my $dbname = "database";
my $host = "127.0.0.1";
my $port = "3306";
my $user = "username";
my $pass = "password";
my $cakey = "ca-cert.pem";
my $clientkey = "win-key.pem.nopass";
my $clientcert = "win-cert.pem";

my $dsn =
DBI->connect("dbi:mysql:dbname=$dbname;host=$host;port=$port;mysql_ssl=1;mys
ql_ssl_ca_file=$cakey;mysql_ssl_client_key=$clientkey;mysql_ssl_client_cert=
$clientcert","$user","$pass",
{AutoCommit => 0}) or print "Error opening database: $DBI::errstr\n";

my $ssl_check = $dsn->prepare("SHOW STATUS LIKE 'ssl_cipher'")
or print "SSL Status Check Failed: $DBI::errstr\n";

$ssl_check->execute()
or print "Execute SSL Status Check Failed: $DBI::errstr\n";

my @ssl_value = $ssl_check->fetchrow_array;

print "SSL Connection Value: ", $ssl_value[0], " : ", $ssl_value[1], "\n";

On my Linux box I compiled DBD::MySQL with -ssl and the connection works,
printing out:
SSL Connection Value: Ssl_cipher : DHE-RSA-AES256-SHA

On my Windows box with ActiveState perl, the exact same code fails and just
prints:
SSL Connection Value: Ssl_cipher :

It appears as though ActiveState's version of DBD::MySQL does not include
SSL support.  Both scripts can pull data from the database but the one on
Windows that uses ActivePerl cannot connect via an SSL connection.  I had
the same issue on Linux until I recompiled DBD::MySQL with "perl Makefile.PL
-ssl", and then "make && make install".

Has anyone gotten SSL working with DBD::MySQL in ActiveState perl?  Surely
this is possible.

 

 

 

Thanks,

 

Josh Berry

 

Reply via email to