| 1 |
# |
| 2 |
# Validate that Group Replication ssl mode works properly. |
| 3 |
# |
| 4 |
# Steps: |
| 5 |
# 1. Start one member with GCS SSL enabled with ssl mode |
| 6 |
# VERIFY_IDENTITY. |
| 7 |
# 2. Start the second member with GCS SSL enabled and |
| 8 |
# validating server certificate against the CA plus |
| 9 |
# validating that server hostname matches server |
| 10 |
# certificate hostname, the member will not be able to |
| 11 |
# join the group, since the certificate contains an invalid |
| 12 |
# hostname. |
| 13 |
# 3. Clean up. |
| 14 |
# |
| 15 |
--source include/big_test.inc |
| 16 |
--source include/check_openssl_version.inc |
| 17 |
--source include/have_group_replication_plugin.inc |
| 18 |
--let $rpl_skip_group_replication_start= 1 |
| 19 |
--source include/group_replication.inc |
| 20 |
|
| 21 |
#check which stack are we using |
| 22 |
--let $have_mysql_stack= `SELECT @@group_replication_communication_stack LIKE 'MySQL'` |
| 23 |
|
| 24 |
--echo |
| 25 |
--echo ############################################################ |
| 26 |
--echo # 1. Start one member with GCS SSL enabled. |
| 27 |
--let $rpl_connection_name= server1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode; |
| 30 |
SET GLOBAL group_replication_ssl_mode= VERIFY_IDENTITY; |
| 31 |
--source include/start_and_bootstrap_group_replication.inc |
| 32 |
|
| 33 |
--let $grep_file= $MYSQLTEST_VARDIR/tmp/group_replication_ssl_mode_verify_identity_error.1.err |
| 34 |
--let $grep_pattern= Group communication SSL configuration: group_replication_ssl_mode: "VERIFY_IDENTITY" |
| 35 |
--let $grep_output= print_count |
| 36 |
--source include/grep_pattern.inc |
| 37 |
|
| 38 |
|
| 39 |
--echo |
| 40 |
--echo ############################################################ |
| 41 |
--echo # 2. Start the second member with GCS SSL enabled and |
| 42 |
--echo # validating server certificate against the CA plus |
| 43 |
--echo # validating that server hostname matches server |
| 44 |
--echo # certificate hostname, the member will not be able to |
| 45 |
--echo # join the group, since the certificate does contain the |
| 46 |
--echo # hostname 'localhost' and the hostname is '127.0.0.1'. |
| 47 |
--let $rpl_connection_name= server2 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
SET @group_replication_ssl_mode_save= @@GLOBAL.group_replication_ssl_mode; |
| 50 |
|
| 51 |
--disable_query_log |
| 52 |
--eval SET GLOBAL group_replication_group_name= '$group_replication_group_name' |
| 53 |
--enable_query_log |
| 54 |
SET GLOBAL group_replication_ssl_mode= VERIFY_IDENTITY; |
| 55 |
|
| 56 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 57 |
START GROUP_REPLICATION; |
| 58 |
|
| 59 |
--let $assert_text= Check that Group Replication is running with SSL VERIFY_IDENTITY enabled |
| 60 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/group_replication_ssl_mode_verify_identity_error.2.err |
| 61 |
--let $assert_select= group_replication_ssl_mode: "VERIFY_IDENTITY" |
| 62 |
--let $assert_count= 1 |
| 63 |
--source include/assert_grep.inc |
| 64 |
|
| 65 |
if(!$have_mysql_stack) { |
| 66 |
--let $have_windows = `SELECT CONVERT(@@version_compile_os using latin1) IN ("Win32", "Win64", "Windows")` |
| 67 |
|
| 68 |
--let $assert_count_for_test=1 |
| 69 |
if($have_windows) { |
| 70 |
--let $assert_count_for_test=2 |
| 71 |
} |
| 72 |
|
| 73 |
--let $assert_text= Check that Group Replication errors out when a certificate with a wrong hostname is provided |
| 74 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/group_replication_ssl_mode_verify_identity_error.2.err |
| 75 |
--let $assert_only_after= XCom initialized and ready to accept incoming connections |
| 76 |
--let $assert_select= Failed to verify the server certificate via X509 certificate matching functions |
| 77 |
--let $assert_count= $assert_count_for_test |
| 78 |
--source include/assert_grep.inc |
| 79 |
} |
| 80 |
|
| 81 |
--echo |
| 82 |
--echo ############################################################ |
| 83 |
--echo # 3. Clean up. |
| 84 |
--let $rpl_connection_name= server1 |
| 85 |
--source include/rpl_connection.inc |
| 86 |
SET GLOBAL group_replication_ssl_mode= @group_replication_ssl_mode_save; |
| 87 |
|
| 88 |
--let $rpl_connection_name= server2 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
SET GLOBAL group_replication_ssl_mode= @group_replication_ssl_mode_save; |
| 91 |
|
| 92 |
--source include/group_replication_end.inc |