Debian Codegraph @

mysql-test/suite/galera/t/galera_ssl_upgrade.test

raw
1 #
2 # Test upgrading the SSL certificates in a rolling fashion.
3 #
4 # 1. The starting state with the old key and cert is is described in galera_ssl_upgrade.cnf
5 #
6
7 --source include/galera_cluster.inc
8 --source include/have_innodb.inc
9 --source include/have_ssl_communication.inc
10 --source include/have_openssl.inc
11 --source include/force_restart.inc
12 --source include/have_perfschema.inc
13
14 # Verify that SSL is handled by the provider.
15 SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%';
16
17 # Save original auto_increment_offset values.
18 --let $node_1=node_1
19 --let $node_2=node_2
20 --source include/auto_increment_offset_save.inc
21
22 # Setup galera ports
23 --connection node_1
24 --source suite/galera/include/galera_base_port.inc
25 --let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
26
27 --connection node_2
28 --source suite/galera/include/galera_base_port.inc
29 --let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
30
31 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
32 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
33
34 # 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate
35
36 --connection node_1
37 --source include/shutdown_mysqld.inc
38 --let $restart_noprint = 1
39 --let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/server-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/server-key.pem
40 --source include/start_mysqld.inc
41 --source include/wait_until_connected_again.inc
42
43 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
44 --source include/wait_condition.inc
45 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
46
47 # 3. Restart node #2 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key
48
49 --connection node_2
50 --source include/shutdown_mysqld.inc
51 --let $start_mysqld_params = --wsrep_provider_options=base_port=$NODE_GALERAPORT_2;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/server-new-key.pem
52 --source include/start_mysqld.inc
53 --source include/wait_until_connected_again.inc
54
55 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
56 --source include/wait_condition.inc
57 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
58
59 # 4. Restart node #1 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key
60
61 --connection node_1
62 --source include/shutdown_mysqld.inc
63 --let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/server-new-key.pem
64 --source include/start_mysqld.inc
65 --source include/wait_until_connected_again.inc
66
67 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
68 --source include/wait_condition.inc
69 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
70
71 # 5. Make sure node_2 is ready as well
72 --connection node_2
73 --source include/galera_wait_ready.inc
74
75 # Upgrade complete. Both nodes now use the new key and certificate
76
77 # Restore original auto_increment_offset values.
78 --source include/auto_increment_offset_restore.inc
79
80 --connection node_1
81 call mtr.add_suppression("WSREP: write_handler\\(\\)");
82 --connection node_2
83 call mtr.add_suppression("WSREP: write_handler\\(\\)");