| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source have_ndb_error_insert.inc |
| 3 |
|
| 4 |
let $NDB_SECRETS_FILE_PATH= $MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.1/ndb_1_fs/D1/NDBCNTR; |
| 5 |
|
| 6 |
--echo |
| 7 |
--echo #### 2.1 - Check that secrets file is created in the File System |
| 8 |
--echo # Check that secretsFile are being created for node 1 |
| 9 |
--file_exists $NDB_SECRETS_FILE_PATH/S0.sysfile |
| 10 |
|
| 11 |
|
| 12 |
--echo |
| 13 |
--echo #### 2.2 Check that secrets file contents is encrypted |
| 14 |
replace_result $NDB_SECRETS_FILE_PATH NDB_SECRETS_FILE_PATH ; |
| 15 |
exec $NDBXFRM 2>&1 |
| 16 |
--info |
| 17 |
$NDB_SECRETS_FILE_PATH/S0.sysfile; |
| 18 |
|
| 19 |
|
| 20 |
--echo |
| 21 |
--echo #### 2.3 Check that secrets file can't be read if filesystem password is incorrect |
| 22 |
--echo # Restart data node 1 |
| 23 |
--exec $NDB_MGM -e "1 RESTART -N" |
| 24 |
--echo # Set RestartOnErrorInsert to 1 (NRT_NoStart_Restart) |
| 25 |
--exec $NDB_MGM -e "1 DUMP 2602 1" |
| 26 |
--echo # Insert Error to force data node to change filesystem password to a wrong one |
| 27 |
--exec $NDB_MGM -e "1 ERROR 1026" |
| 28 |
--exec $NDB_MGM -e "1 START" |
| 29 |
--sleep 1 |
| 30 |
--exec $NDB_WAITER --not-started --wait-nodes=1 >> $NDB_TOOLS_OUTPUT |
| 31 |
|
| 32 |
--let $assert_select=-- Failed to read secrets file using the provided filesystem password |
| 33 |
--let $assert_text= Wrong filesystem password used to open (for read) secrets file |
| 34 |
--let $assert_file= $MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.1/ndbd.log |
| 35 |
--let $assert_match = .*Failed to read secrets file using the provided filesystem password.* |
| 36 |
--source include/assert_grep.inc |
| 37 |
|
| 38 |
|
| 39 |
--echo |
| 40 |
--echo #### 2.4 Check that if secretes file is corrupt files aren't decrypted |
| 41 |
--echo # Set RestartOnErrorInsert to 1 (NRT_NoStart_Restart) |
| 42 |
--exec $NDB_MGM -e "1 DUMP 2602 1" |
| 43 |
|
| 44 |
--echo # backup secrets file and write a new one with invalid data |
| 45 |
move_file $NDB_SECRETS_FILE_PATH/S0.sysfile $NDB_SECRETS_FILE_PATH/S0.sysfile.back; |
| 46 |
write_file $NDB_SECRETS_FILE_PATH/S0.sysfile; |
| 47 |
INVALIDDATA |
| 48 |
EOF |
| 49 |
|
| 50 |
--echo # Insert error 1027 for CRASH_INSERTION in data node to make it crash in a soft way |
| 51 |
--echo # when secretsfile is invalid |
| 52 |
--exec $NDB_MGM -e "1 ERROR 1027" |
| 53 |
--exec $NDB_MGM -e "1 START" |
| 54 |
--sleep 1 |
| 55 |
--exec $NDB_WAITER --not-started --wait-nodes=1 >> $NDB_TOOLS_OUTPUT; |
| 56 |
|
| 57 |
--let $assert_select=-- Failed to read secrets file, error: 2816 |
| 58 |
--let $assert_text=Corrupt Secretsfile |
| 59 |
--let $assert_file= $MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.1/ndbd.log |
| 60 |
--let $assert_match = .*Failed to read secrets file, error: 2816.* |
| 61 |
--source include/assert_grep.inc |
| 62 |
|
| 63 |
--echo # restore secrets file from backup |
| 64 |
remove_file $NDB_SECRETS_FILE_PATH/S0.sysfile; |
| 65 |
move_file $NDB_SECRETS_FILE_PATH/S0.sysfile.back $NDB_SECRETS_FILE_PATH/S0.sysfile; |
| 66 |
|
| 67 |
--echo # Set RestartOnErrorInsert back to 2 (NRT_DoStart_Restart) |
| 68 |
--exec $NDB_MGM -e "1 DUMP 2602 2" |
| 69 |
--sleep 1 |
| 70 |
--exec $NDB_MGM -e "1 START" |
| 71 |
--exec $NDB_WAITER --wait-nodes=1 >> $NDB_TOOLS_OUTPUT |
| 72 |
|
| 73 |
--echo |
| 74 |
--echo #### 2.5 Check that secrets file content with same password is encrypted differently |
| 75 |
--echo # due to salts |
| 76 |
|
| 77 |
--perl |
| 78 |
use strict; |
| 79 |
use Symbol; |
| 80 |
use File::Compare; |
| 81 |
my $vardir = $ENV{MYSQLTEST_VARDIR} |
| 82 |
or die "need MYSQLTEST_VARDIR"; |
| 83 |
my $secretsfile1 = "$vardir/mysql_cluster.1/ndbd.1/ndb_1_fs/D1/NDBCNTR/S0.sysfile"; |
| 84 |
my $secretsfile2 = "$vardir/mysql_cluster.1/ndbd.2/ndb_2_fs/D1/NDBCNTR/S0.sysfile"; |
| 85 |
|
| 86 |
my $comp = compare($secretsfile1, $secretsfile2); |
| 87 |
if($comp == -1){ |
| 88 |
print "Error accessing secrets file\n" ; |
| 89 |
} |
| 90 |
elsif($comp == 0){ |
| 91 |
print "Secretsfiles are equal\n"; |
| 92 |
} |
| 93 |
else{ |
| 94 |
print "Data node 1 and data node 2 are using the same filesystem password but their |
| 95 |
secretsfile content differs due to salts\n"; |
| 96 |
} |
| 97 |
EOF |
| 98 |
|
| 99 |
|
| 100 |
--echo |
| 101 |
--echo #### 2.6 Check that user files are encrypted |
| 102 |
let $NDB_LCP_FILES_0 = $MYSQLTEST_VARDIR/mysql_cluster.1/ndbd.1/ndb_1_fs/LCP/0; |
| 103 |
replace_result $NDB_LCP_FILES_0 NDB_LCP_FILES_0; |
| 104 |
exec $NDBXFRM 2>&1 |
| 105 |
--info |
| 106 |
$NDB_LCP_FILES_0/T2F1.Data; |
| 107 |
|
| 108 |
|
| 109 |
--echo |
| 110 |
--echo # Test ended, cleanup files. |
| 111 |
remove_file $NDB_TOOLS_OUTPUT; |
| 112 |
|