From 2b7828237d7ad6505ea2a83d48cac49d74229e08 Mon Sep 17 00:00:00 2001 From: Daniel Kolvik Date: Fri, 15 Sep 2017 10:53:57 +0200 Subject: [PATCH] Add support to pass ssl public key to mysql connection. Makes it possible to run against servers only accepting connection over SSL. --- mysqltuner.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index b14f699..d1c5cfb 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -75,6 +75,7 @@ my %opt = ( "user" => 0, "pass" => 0, "password" => 0, + "ssl-ca" => 0, "skipsize" => 0, "checkversion" => 0, "updateversion" => 0, @@ -119,7 +120,7 @@ GetOptions( 'verbose', 'sysstat', 'password=s', 'pfstat', 'passenv=s', 'userenv=s', - 'defaults-file=s' + 'defaults-file=s','ssl-ca=s' ) or pod2usage( -exitval => 1, @@ -706,6 +707,19 @@ sub mysql_setup { $opt{host} = '127.0.0.1'; } + if ( $opt{'ssl-ca'} ne 0 ) { + if ( -e -r -f $opt{'ssl-ca'} ) { + $remotestring .= " --ssl-ca=$opt{'ssl-ca'}"; + infoprint "Will connect using ssl public key passed on the command line"; + return 1; + } + else { + badprint + "Attempted to use passed ssl public key, but it was not found or could not be read"; + exit 1; + } + } + # Did we already get a username without password on the command line? if ( $opt{user} ne 0 and $opt{pass} eq 0 ) { $mysqllogin = "-u $opt{user} " . $remotestring; @@ -6145,6 +6159,7 @@ You must provide the remote server's total memory when connecting to other serve --userenv Name of env variable which contains username to use for authentication --pass Password to use for authentication --passenv Name of env variable which contains password to use for authentication + --ssl-ca Path to public key --mysqladmin Path to a custom mysqladmin executable --mysqlcmd Path to a custom mysql executable --defaults-file Path to a custom .my.cnf