| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# To verify that 'ALTER INSTANCE ROTATE BINLOG MASTER KEY' works as expected. |
| 4 |
# |
| 5 |
# ==== Implementation ==== |
| 6 |
# |
| 7 |
# 1. Verify that the before (latest) binary log is encrypted using |
| 8 |
# current master key. |
| 9 |
# 2. Set debug point to verify_unusable_encryption_keys_are_purged. |
| 10 |
# 3. Execute 'ALTER INSTANCE ROTATE BINLOG MASTER KEY'. |
| 11 |
# 4. Verify that the new generated binary log is encrypted using |
| 12 |
# rotated master key. |
| 13 |
# 5. Verify that the before binary log is re-encrypted using |
| 14 |
# rotated master key. |
| 15 |
# 6. Verify that the first encrypted binary log is re-encrypted |
| 16 |
# using rotated master key. |
| 17 |
# |
| 18 |
# ==== Usage ==== |
| 19 |
# |
| 20 |
# --let $MASTER_DATADIR= `select @@datadir` |
| 21 |
# --let $first_encrypted_binary_log= |
| 22 |
# --let $current_master_key_id= |
| 23 |
# --let $current_comparison_digit= |
| 24 |
# --let $rotated_master_key_id= |
| 25 |
# --let $rotated_comparison_digit= |
| 26 |
# --source suite/binlog/include/binlog_rotate_binlog_master_key_work.inc |
| 27 |
# |
| 28 |
# Parameters: |
| 29 |
# |
| 30 |
# $first_encrypted_binary_log |
| 31 |
# The first encrypted binary log. |
| 32 |
# |
| 33 |
# $current_master_key_id |
| 34 |
# The master key id before rotating binlog master key. |
| 35 |
# |
| 36 |
# $current_comparison_digit |
| 37 |
# The comparison digit of $current_master_key_id |
| 38 |
# |
| 39 |
# $rotated_master_key_id |
| 40 |
# The master key id after rotating binlog master key. |
| 41 |
# |
| 42 |
# $rotated_comparison_digit |
| 43 |
# The comparison digit of $rotated_master_key_id |
| 44 |
# |
| 45 |
# ==== References ==== |
| 46 |
# |
| 47 |
# Wl#12080 Add support to binary log encryption key rotation and cleanup |
| 48 |
|
| 49 |
|
| 50 |
--let $before_binary_log=query_get_value(SHOW MASTER STATUS, File, 1) |
| 51 |
--let $rpl_log_file=$MASTER_DATADIR$before_binary_log |
| 52 |
--source include/rpl_get_log_encryption_key_id.inc |
| 53 |
--let $assert_text=the before binary log is encrypted using current master key with key id: $current_master_key_id |
| 54 |
--let $assert_cond= RIGHT("$rpl_encryption_key_id", $current_comparison_digit) = "_$current_master_key_id" |
| 55 |
--source include/assert.inc |
| 56 |
|
| 57 |
--let $debug_point=verify_unusable_encryption_keys_are_purged |
| 58 |
--source include/add_debug_point.inc |
| 59 |
ALTER INSTANCE ROTATE BINLOG MASTER KEY; |
| 60 |
--source include/remove_debug_point.inc |
| 61 |
INSERT INTO t1 VALUES (1); |
| 62 |
|
| 63 |
--let $after_binary_log=query_get_value(SHOW MASTER STATUS, File, 1) |
| 64 |
--let $rpl_log_file=$MASTER_DATADIR$after_binary_log |
| 65 |
--source include/rpl_get_log_encryption_key_id.inc |
| 66 |
--let $assert_text=the after binary log is encrypted using rotated master key with key id: $rotated_master_key_id |
| 67 |
--let $assert_cond= RIGHT("$rpl_encryption_key_id", $rotated_comparison_digit) = "_$rotated_master_key_id" |
| 68 |
--source include/assert.inc |
| 69 |
|
| 70 |
--let $rpl_log_file=$MASTER_DATADIR$before_binary_log |
| 71 |
--source include/rpl_get_log_encryption_key_id.inc |
| 72 |
--let $assert_text=the before binary log is re-encrypted using rotated master key with key id: $rotated_master_key_id |
| 73 |
--let $assert_cond= RIGHT("$rpl_encryption_key_id", $rotated_comparison_digit) = "_$rotated_master_key_id" |
| 74 |
--source include/assert.inc |
| 75 |
|
| 76 |
--let $rpl_log_file=$MASTER_DATADIR$first_encrypted_binary_log |
| 77 |
--source include/rpl_get_log_encryption_key_id.inc |
| 78 |
--let $assert_text=the first encrypted binary log is re-encrypted using rotated master key with key id: $rotated_master_key_id |
| 79 |
--let $assert_cond= RIGHT("$rpl_encryption_key_id", $rotated_comparison_digit) = "_$rotated_master_key_id" |
| 80 |
--source include/assert.inc |