| 1 |
source include/have_ndb.inc; |
| 2 |
|
| 3 |
let $secret_key = $MYSQL_TMP_DIR/secret_key.txt; |
| 4 |
|
| 5 |
--echo Verify that ndb_secretsfile_reader prints the correct node master key |
| 6 |
--echo if valid secrets file (S0.sysfile) and correct filesystem-password are provided |
| 7 |
exec $NDB_SECRETSFILE_READER |
| 8 |
--filesystem-password=topsecret |
| 9 |
suite/ndb/ndbfs_files/8.0.31_le/NDBCNTR/S0.sysfile; |
| 10 |
|
| 11 |
exec $NDB_SECRETSFILE_READER |
| 12 |
--filesystem-password=topsecret |
| 13 |
suite/ndb/ndbfs_files/8.0.31_be/NDBCNTR/S0.sysfile; |
| 14 |
|
| 15 |
|
| 16 |
--echo |
| 17 |
--echo Verify that ndb_secretsfile_reader throws an error if provided filesystem-password is not correct |
| 18 |
--error 1 |
| 19 |
exec $NDB_SECRETSFILE_READER |
| 20 |
--filesystem-password=wrongpwd |
| 21 |
suite/ndb/ndbfs_files/8.0.31_le/NDBCNTR/S0.sysfile 2>&1; |
| 22 |
|
| 23 |
|
| 24 |
--echo |
| 25 |
--echo Verify that ndb_secretsfile_reader throws a warning if provided file is not encrypted |
| 26 |
--echo Create an unencrypted version of secrets file (S0.sysfile) |
| 27 |
exec $NDBXFRM |
| 28 |
--decrypt-password="topsecret" |
| 29 |
suite/ndb/ndbfs_files/8.0.31_le/NDBCNTR/S0.sysfile |
| 30 |
$MYSQL_TMP_DIR/S0_decrypted.sysfile; |
| 31 |
|
| 32 |
exec $NDB_SECRETSFILE_READER |
| 33 |
--filesystem-password=topsecret |
| 34 |
$MYSQL_TMP_DIR/S0_decrypted.sysfile 2>&1; |
| 35 |
|
| 36 |
|
| 37 |
--echo |
| 38 |
--echo Verify that ndb_secretsfile_reader throws an error if provided file is not a valid secretsfile |
| 39 |
--echo Create an invalid secrets file |
| 40 |
write_file $MYSQL_TMP_DIR/S0_invalid.sysfile; |
| 41 |
INVALID |
| 42 |
DATA |
| 43 |
EOF |
| 44 |
|
| 45 |
--error 1 |
| 46 |
exec $NDB_SECRETSFILE_READER |
| 47 |
--filesystem-password=topsecret |
| 48 |
$MYSQL_TMP_DIR/S0_invalid.sysfile 2>&1; |
| 49 |
|
| 50 |
|
| 51 |
--echo |
| 52 |
--echo Verify that NMK stored in secretsfile of current live cluster is valid and |
| 53 |
--echo can be used to successfully decrypt system files. |
| 54 |
--echo Extract NMK from secrets file |
| 55 |
exec $NDB_SECRETSFILE_READER |
| 56 |
--filesystem-password=topsecret |
| 57 |
$MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.2/ndb_2_fs/D1/NDBCNTR/S0.sysfile |
| 58 |
> $secret_key; |
| 59 |
|
| 60 |
--echo Decrypt system file using the extracted NMK |
| 61 |
exec $NDBXFRM 2>&1 < $secret_key |
| 62 |
--decrypt-key-from-stdin |
| 63 |
$MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.2/ndb_2_fs/D8/DBLQH/S0.FragLog |
| 64 |
$MYSQL_TMP_DIR/S0_decrypted.FragLog; |
| 65 |
|
| 66 |
|
| 67 |
--remove_file $secret_key |
| 68 |
--remove_file $MYSQL_TMP_DIR/S0_decrypted.sysfile |
| 69 |
--remove_file $MYSQL_TMP_DIR/S0_invalid.sysfile |
| 70 |
--remove_file $MYSQL_TMP_DIR/S0_decrypted.FragLog |