1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
--source include/have_null_audit_plugin.inc
--source include/xplugin_preamble.inc
--disable_ps_protocol
--disable_warnings
--enable_connect_log
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN null_audit SONAME '$AUDIT_NULL';
CREATE USER audit_user@localhost IDENTIFIED BY 'audit_pw';
GRANT ALL PRIVILEGES ON *.* TO audit_user@localhost WITH GRANT OPTION;
## Test starts here
--write_file $MYSQL_TMP_DIR/mysqlx-connection-setup.tmp
-->sql
CREATE USER user1_mysqlx@localhost
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string1';
CREATE USER user3_mysqlx@localhost
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string3'
REQUIRE CIPHER "ECDHE-RSA-AES128-GCM-SHA256" AND
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
PASSWORD EXPIRE NEVER;
CREATE USER user5_mysqlx@localhost
IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
REQUIRE SSL;
GRANT ALL ON *.* TO user1_mysqlx@localhost;
GRANT ALL ON *.* TO user3_mysqlx@localhost;
GRANT ALL ON *.* TO user5_mysqlx@localhost;
-->endsql
EOF
--exec $MYSQLXTEST --ssl-mode=REQUIRED -h localhost -u audit_user --password='audit_pw' --plain-auth --file=$MYSQL_TMP_DIR/mysqlx-connection-setup.tmp 2>&1
--write_file $MYSQL_TMP_DIR/mysqlx-connection-info.tmp
-->sql
SELECT USER();
-->endsql
EOF
SET GLOBAL null_audit_event_order_check_consume_ignore_count = 6;
SET GLOBAL null_audit_event_order_check = "MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE;;ABORT_RET";
--error 1
exec $MYSQLXTEST
--ssl-mode=REQUIRED --history-protocol false
-u user1_mysqlx --password='auth_string1' --plain-auth
--file=$MYSQL_TMP_DIR/mysqlx-connection-info.tmp 2>&1;
--error 1
exec $MYSQLXTEST
--tls-version=TLSv1.2 --ssl-mode=REQUIRED --history-protocol false
-u user3_mysqlx --password='auth_string3' --plain-auth
--ssl-cipher="ECDHE-RSA-AES128-GCM-SHA256" --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem
--file=$MYSQL_TMP_DIR/mysqlx-connection-info.tmp 2>&1;
--error 1
exec $MYSQLXTEST
--ssl-mode=REQUIRED --history-protocol false
-u user5_mysqlx --password='auth_string' --plain-auth
--ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem --file=$MYSQL_TMP_DIR/mysqlx-connection-info.tmp 2>&1;
UNINSTALL PLUGIN null_audit;
# Cleanup
--remove_file $MYSQL_TMP_DIR/mysqlx-connection-setup.tmp
--remove_file $MYSQL_TMP_DIR/mysqlx-connection-info.tmp
DROP USER user1_mysqlx@localhost,user3_mysqlx@localhost,
user5_mysqlx@localhost,audit_user@localhost;
--echo # END OF TEST
--enable_warnings
|