diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
commit | a2a2e32c02643a0cec111511220227703fda1cd5 (patch) | |
tree | 69cc2b631234c2a8e026b9cd4d72676c61c594df /mysql-test/lib | |
parent | Releasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff) | |
download | mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip |
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/lib')
-rw-r--r-- | mysql-test/lib/My/Debugger.pm | 2 | ||||
-rwxr-xr-x | mysql-test/lib/generate-ssl-certs.sh | 2 | ||||
-rw-r--r-- | mysql-test/lib/mtr_cases.pm | 12 | ||||
-rwxr-xr-x | mysql-test/lib/ssl-mitm.pl | 95 | ||||
-rwxr-xr-x | mysql-test/lib/v1/mysql-test-run.pl | 24 |
5 files changed, 115 insertions, 20 deletions
diff --git a/mysql-test/lib/My/Debugger.pm b/mysql-test/lib/My/Debugger.pm index 907638c9..2ab8a352 100644 --- a/mysql-test/lib/My/Debugger.pm +++ b/mysql-test/lib/My/Debugger.pm @@ -78,7 +78,7 @@ my %debuggers = ( options => '-f -o {log} {exe} {args}', }, rr => { - options => '_RR_TRACE_DIR={log} rr record {exe} {args} --loose-skip-innodb-use-native-aio --loose-innodb-flush-method=fsync', + options => '_RR_TRACE_DIR={log} rr record {exe} {args}', run => 'env', pre => sub { ::mtr_error('rr requires kernel.perf_event_paranoid <= 1') diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh index 57caf3b7..050a5aa8 100755 --- a/mysql-test/lib/generate-ssl-certs.sh +++ b/mysql-test/lib/generate-ssl-certs.sh @@ -27,7 +27,7 @@ openssl rsa -in server-key.pem -out server-key.pem # sign the server certificate with CA certificate openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -in demoCA/server-req.pem -# server certificate with different validity period (MDEV-7598) +# server certificate with different validity period (MDEV-16266) openssl req -newkey rsa:4096 -keyout server-new-key.pem -out demoCA/server-new-req.pem -days 7301 -nodes -subj '/CN=server-new/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' openssl rsa -in server-new-key.pem -out server-new-key.pem openssl ca -keyfile cakey.pem -days 7301 -batch -cert cacert.pem -policy policy_anything -out server-new-cert.pem -in demoCA/server-new-req.pem diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index c7271757..be1c2be8 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -67,8 +67,8 @@ if (-d '../sql') { @plugin_suitedirs= ('storage/*/mysql-test', 'plugin/*/mysql-test', 'storage/*/*/mysql-test', ); $overlay_regex= '\b(?:storage|plugin|storage[/][^/]*)/(\w+)/mysql-test\b'; } else { - @plugin_suitedirs= ('mysql-test/plugin/*'); - $overlay_regex= '\bmysql-test/plugin/(\w+)\b'; + @plugin_suitedirs= ('mariadb-test/plugin/*'); + $overlay_regex= '\bmariadb-test/plugin/(\w+)\b'; } $plugin_suitedir_regex= $overlay_regex; $plugin_suitedir_regex=~ s/\Q(\w+)\E/\\w+/; @@ -288,8 +288,8 @@ sub load_suite_object { sub suite_for_file($) { my ($file) = @_; return ($2, $1) if $file =~ m@^(.*/$plugin_suitedir_regex/(\w+))/@o; - return ($2, $1) if $file =~ m@^(.*/mysql-test/suite/(\w+))/@; - return ('main', $1) if $file =~ m@^(.*/mysql-test)/@; + return ($2, $1) if $file =~ m@^(.*/(?:mysql|mariadb)-test/suite/(\w+))/@; + return ('main', $1) if $file =~ m@^(.*/(?:mysql|mariadb)-test)/@; mtr_error("Cannot determine suite for $file"); } @@ -397,14 +397,14 @@ sub collect_suite_name($$) else { my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), - ["mysql-test/suite", @plugin_suitedirs ], + ["mariadb-test/suite", "mysql-test/suite", @plugin_suitedirs ], $suitename); # # if $suitename contained wildcards, we'll have many suites and # their overlays here. Let's group them appropriately. # for (@dirs) { - m@^.*/(?:mysql-test/suite|$plugin_suitedir_regex)/(.*)$@o or confess $_; + m@^.*/(?:mariadb-test/suite|mysql-test/suite|$plugin_suitedir_regex)/(.*)$@o or confess $_; push @{$suites{$1}}, $_; } } diff --git a/mysql-test/lib/ssl-mitm.pl b/mysql-test/lib/ssl-mitm.pl new file mode 100755 index 00000000..73652f0f --- /dev/null +++ b/mysql-test/lib/ssl-mitm.pl @@ -0,0 +1,95 @@ +#!/usr/bin/env perl + +# mitm for mariadb procotol with ssl + +use strict; +use warnings; +use autodie; +use Getopt::Long; +use Socket qw(PF_INET SOCK_STREAM INADDR_ANY INADDR_LOOPBACK sockaddr_in SO_REUSEADDR SOL_SOCKET); +use Net::SSLeay; + +my $opt_listen_port; +my $opt_connect_port; +my $opt_key; +my $opt_cert; +my $opt_ca; + +my %options=( + 'listen-on=i' => \$opt_listen_port, + 'connect-to=i' => \$opt_connect_port, + 'ssl-key=s' => \$opt_key, + 'ssl-cert=s' => \$opt_cert, + 'ssl-ca=s' => \$opt_ca, +); + +GetOptions(%options) or usage("Can't read options"); +die "not all options set" unless $opt_listen_port and $opt_connect_port + and $opt_key and $opt_cert and $opt_ca; + +Net::SSLeay::load_error_strings(); +Net::SSLeay::SSLeay_add_ssl_algorithms(); + +my $servctx = Net::SSLeay::CTX_new(); +my $servssl = Net::SSLeay::new($servctx); + +my $clictx = Net::SSLeay::CTX_new(); +Net::SSLeay::CTX_load_verify_locations($clictx, $opt_ca, ''); +Net::SSLeay::set_cert_and_key($clictx, $opt_cert, $opt_key); +my $clissl = Net::SSLeay::new($clictx); + +socket(my $listen, PF_INET, SOCK_STREAM, getprotobyname('tcp')); +setsockopt($listen, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)); +bind($listen, sockaddr_in($opt_listen_port, INADDR_ANY)); +listen($listen, 1); +warn "$$: listening"; + +print ">> MitM active <<\n"; +close STDOUT; + +fork and exit; +warn "$$: forked"; + +accept(my $client, $listen); +warn "$$: accepted"; + +socket(my $server, PF_INET, SOCK_STREAM, getprotobyname('tcp')); +connect($server, sockaddr_in($opt_connect_port, INADDR_LOOPBACK)); +warn "$$: connected"; + +# handshake server -> client +recv $server, $_, 1e6, 0; +send $client, $_, 0; +warn "$$: handshake server -> client (".length.")"; + +# client replies with a dummy +recv $client, $_, 36, 0; +send $server, $_, 0; +warn "$$: client replies with a dummy (".length.")"; + +# SSL with server +Net::SSLeay::set_fd($servssl, fileno($server)); +Net::SSLeay::connect($servssl); +warn "$$: ssl connect server"; + +# SSL accept client +Net::SSLeay::set_fd($clissl, fileno($client)); +Net::SSLeay::accept($clissl); +warn "$$: ssl accept client"; + +while (1) { + $_=Net::SSLeay::read($clissl) or last; + warn "$$: ssl read client ".length.")"; + s/Detecting MitM/No MitM found!/; + Net::SSLeay::write($servssl, $_) or last; + warn "$$: ssl write server ".length.")"; + $_=Net::SSLeay::read($servssl) or last; + warn "$$: ssl read server ".length.")"; + Net::SSLeay::write($clissl, $_) or last; + warn "$$: ssl write client ".length.")"; +} + +close($server); +close($client); +close($listen); +warn "$$: ----------\n"; diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index aabe3d75..ce1d38b1 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -1497,7 +1497,7 @@ sub mysql_client_test_arguments() if ( $opt_debug ) { mtr_add_arg($args, - "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace"); + "--debug-dbug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace"); } if ( $glob_use_embedded_server ) @@ -1535,7 +1535,7 @@ sub mysql_upgrade_arguments() if ( $opt_debug ) { mtr_add_arg($args, - "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace"); + "--debug-dbug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace"); } return join(" ", $exe, @$args); @@ -1663,7 +1663,7 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqlcheck .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace"; } $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck; @@ -1676,9 +1676,9 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqldump .= - " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace"; $cmdline_mysqldumpslave .= - " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace"; } $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump; $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave; @@ -1698,7 +1698,7 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqlslap .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqlslap.trace"; } $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap; } @@ -1715,7 +1715,7 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqlimport .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqlimport.trace"; } $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport; @@ -1732,7 +1732,7 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqlshow .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqlshow.trace"; } $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow; @@ -1753,7 +1753,7 @@ sub environment_setup () { if ( $opt_debug ) { $cmdline_mysqlbinlog .= - " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace"; + " --debug-dbug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace"; } $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog; @@ -2460,7 +2460,7 @@ sub install_db ($$) { if ( $opt_debug ) { - mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace", + mtr_add_arg($args, "--debug-dbug=d:t:i:A,%s/log/bootstrap_%s.trace", $path_vardir_trace, $type); } @@ -3186,7 +3186,7 @@ sub mysqld_arguments ($$$$) { { if ( $opt_debug ) { - mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace", + mtr_add_arg($args, "%s--debug-dbug=d:t:i:A,%s/log/%s%s.trace", $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx); } else @@ -3825,7 +3825,7 @@ sub run_mysqltest ($) { if ( $opt_debug ) { - mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", + mtr_add_arg($args, "--debug-dbug=d:t:A,%s/log/mysqltest.trace", $path_vardir_trace); } |