| 1 |
# |
| 2 |
# Test whether all MYSQL_AUDIT_AUTHENTICATION_XXX events are non abortable. |
| 3 |
# |
| 4 |
--source include/have_null_audit_plugin.inc |
| 5 |
|
| 6 |
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE' cannot be aborted."); |
| 7 |
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME' cannot be aborted."); |
| 8 |
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP' cannot be aborted."); |
| 9 |
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_FLUSH' cannot be aborted."); |
| 10 |
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE with my_message."); |
| 11 |
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME with my_message."); |
| 12 |
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP with my_message."); |
| 13 |
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_FLUSH with my_message."); |
| 14 |
|
| 15 |
--replace_regex /\.dll/.so/ |
| 16 |
eval INSTALL PLUGIN null_audit SONAME '$AUDIT_NULL'; |
| 17 |
|
| 18 |
let $event_order_exact= 1; |
| 19 |
let $command_id= 3; |
| 20 |
if(`SELECT $PS_PROTOCOL > 0`) |
| 21 |
{ |
| 22 |
let $event_order_exact= 0; |
| 23 |
let $command_id= 22; |
| 24 |
} |
| 25 |
|
| 26 |
--echo ############################################## |
| 27 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE ## |
| 28 |
--echo ############################################## |
| 29 |
--replace_result $event_order_exact <expected_check_exact> |
| 30 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 31 |
--replace_result $command_id <expected_command_id> |
| 32 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 33 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 34 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 35 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 36 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="84";;' |
| 37 |
'MYSQL_AUDIT_QUERY_STATUS_END;sql_command_id="84";;' |
| 38 |
'MYSQL_AUDIT_GENERAL_RESULT;;;' |
| 39 |
'MYSQL_AUDIT_GENERAL_STATUS;;;' |
| 40 |
'MYSQL_AUDIT_COMMAND_END;command_id="$command_id";'; |
| 41 |
CREATE USER testuser@localhost IDENTIFIED BY 'testpwd'; |
| 42 |
SELECT @@null_audit_event_order_check; |
| 43 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE - END ## |
| 44 |
|
| 45 |
--echo ################################################## |
| 46 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE ## |
| 47 |
--echo ################################################## |
| 48 |
--replace_result $event_order_exact <expected_check_exact> |
| 49 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 50 |
let $quoted_command_id= "$command_id"; |
| 51 |
--replace_result $quoted_command_id "\"<expected_command_id>\"" |
| 52 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 53 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 54 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 55 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 56 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="134";;' |
| 57 |
'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE;;ABORT_RET'; |
| 58 |
ALTER USER testuser@localhost IDENTIFIED BY 'NewPass'; |
| 59 |
SELECT @@null_audit_event_order_check; |
| 60 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE - END ## |
| 61 |
|
| 62 |
--echo ############################################## |
| 63 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME ## |
| 64 |
--echo ############################################## |
| 65 |
--replace_result $event_order_exact <expected_check_exact> |
| 66 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 67 |
--replace_result $command_id <expected_command_id> |
| 68 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 69 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 70 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 71 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 72 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="86";;' |
| 73 |
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME;;ABORT_RET'; |
| 74 |
RENAME USER testuser@localhost TO newuser@localhost; |
| 75 |
SELECT @@null_audit_event_order_check; |
| 76 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME - END ## |
| 77 |
|
| 78 |
--echo ############################################ |
| 79 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP ## |
| 80 |
--echo ############################################ |
| 81 |
--replace_result $event_order_exact <expected_check_exact> |
| 82 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 83 |
--replace_result "$command_id" <expected_command_id> |
| 84 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 85 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 86 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 87 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 88 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="85";;' |
| 89 |
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP;;ABORT_RET'; |
| 90 |
DROP USER newuser@localhost; |
| 91 |
SELECT @@null_audit_event_order_check; |
| 92 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP - END ## |
| 93 |
|
| 94 |
--echo ###################################### |
| 95 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH ## |
| 96 |
--echo ###################################### |
| 97 |
eval SET @@null_audit_event_order_check_exact = 1; |
| 98 |
SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="3";;' |
| 99 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 100 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 101 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 102 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="49";;' |
| 103 |
'MYSQL_AUDIT_AUTHENTICATION_FLUSH;;ABORT_RET'; |
| 104 |
FLUSH PRIVILEGES; |
| 105 |
SELECT @@null_audit_event_order_check; |
| 106 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH - END ## |
| 107 |
|
| 108 |
--echo ################################################## |
| 109 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE ## |
| 110 |
--echo ################################################## |
| 111 |
|
| 112 |
CREATE USER testuser@localhost IDENTIFIED BY 'testpwd'; |
| 113 |
|
| 114 |
--replace_result $event_order_exact <expected_check_exact> |
| 115 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 116 |
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE with my_message."; |
| 117 |
|
| 118 |
let $quoted_command_id= "$command_id"; |
| 119 |
--replace_result $quoted_command_id "\"<expected_command_id>\"" |
| 120 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 121 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 122 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 123 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 124 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="134";;' |
| 125 |
'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE;;ABORT_RET'; |
| 126 |
ALTER USER testuser@localhost IDENTIFIED BY 'NewPass'; |
| 127 |
SELECT @@null_audit_event_order_check; |
| 128 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE - END ## |
| 129 |
|
| 130 |
--echo ############################################## |
| 131 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME ## |
| 132 |
--echo ############################################## |
| 133 |
|
| 134 |
--replace_result $event_order_exact <expected_check_exact> |
| 135 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 136 |
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME with my_message."; |
| 137 |
|
| 138 |
--replace_result $command_id <expected_command_id> |
| 139 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 140 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 141 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 142 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 143 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="86";;' |
| 144 |
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME;;ABORT_RET'; |
| 145 |
RENAME USER testuser@localhost TO newuser@localhost; |
| 146 |
SELECT @@null_audit_event_order_check; |
| 147 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME - END ## |
| 148 |
|
| 149 |
--echo ############################################ |
| 150 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP ## |
| 151 |
--echo ############################################ |
| 152 |
|
| 153 |
--replace_result $event_order_exact <expected_check_exact> |
| 154 |
eval SET @@null_audit_event_order_check_exact = $event_order_exact; |
| 155 |
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP with my_message."; |
| 156 |
--replace_result "$command_id" <expected_command_id> |
| 157 |
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;' |
| 158 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 159 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 160 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 161 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="85";;' |
| 162 |
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP;;ABORT_RET'; |
| 163 |
DROP USER newuser@localhost; |
| 164 |
SELECT @@null_audit_event_order_check; |
| 165 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP - END ## |
| 166 |
|
| 167 |
--echo ###################################### |
| 168 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH ## |
| 169 |
--echo ###################################### |
| 170 |
|
| 171 |
eval SET @@null_audit_event_order_check_exact = 1; |
| 172 |
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_FLUSH with my_message."; |
| 173 |
SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="3";;' |
| 174 |
'MYSQL_AUDIT_PARSE_PREPARSE;;;' |
| 175 |
'MYSQL_AUDIT_PARSE_POSTPARSE;;;' |
| 176 |
'MYSQL_AUDIT_GENERAL_LOG;;;' |
| 177 |
'MYSQL_AUDIT_QUERY_START;sql_command_id="49";;' |
| 178 |
'MYSQL_AUDIT_AUTHENTICATION_FLUSH;;ABORT_RET'; |
| 179 |
FLUSH PRIVILEGES; |
| 180 |
SELECT @@null_audit_event_order_check; |
| 181 |
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH - END ## |
| 182 |
|
| 183 |
|
| 184 |
UNINSTALL PLUGIN null_audit; |