147 lines
5.4 KiB
Plaintext
147 lines
5.4 KiB
Plaintext
#
|
|
# WL#5706/Bug#58712/Bug#11746378
|
|
# Encrypt or remove passwords from slow, query, and binary logs
|
|
# (see sql/sql_rewrite.cc for bulk of implementation)
|
|
#
|
|
|
|
--source include/not_windows.inc
|
|
|
|
# For Bug#16467055 and friends:
|
|
|
|
# make sure we start with a clean slate. log_tables.test says this is OK.
|
|
TRUNCATE TABLE mysql.slow_log;
|
|
|
|
SET @old_master_info_repository = @@GLOBAL.master_info_repository;
|
|
SET @old_relay_log_info_repository = @@GLOBAL.relay_log_info_repository;
|
|
SET @old_log_output= @@global.log_output;
|
|
SET @old_slow_query_log= @@global.slow_query_log;
|
|
SET @old_slow_query_log_file= @@global.slow_query_log_file;
|
|
SET @old_long_query_time= @@global.long_query_time;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR ...
|
|
eval SET GLOBAL slow_query_log_file= '$MYSQLTEST_VARDIR/log/rewrite_slow.log';
|
|
SET GLOBAL log_output = 'FILE,TABLE';
|
|
SET GLOBAL slow_query_log= 'ON';
|
|
|
|
# The answer is obvious: log everything!
|
|
SET SESSION long_query_time= 0;
|
|
|
|
# Show that obfuscation applies to the slow log at all.
|
|
# If one applies, they all do, and we've already demonstrated the individual
|
|
# obfuscations above for the general log.
|
|
|
|
# 1.1.1.1
|
|
CREATE USER test_user2 IDENTIFIED BY 'azundris2';
|
|
connect(con1,localhost,test_user2,'azundris2',);
|
|
SET SESSION long_query_time = 0;
|
|
# Verification of WL#11544
|
|
ALTER USER test_user2 IDENTIFIED BY 'azundris2' REPLACE 'azundris2';
|
|
SET PASSWORD='azundris2' REPLACE 'azundris2';
|
|
SET PASSWORD FOR test_user2='azundris2' REPLACE 'azundris2';
|
|
disconnect con1;
|
|
connection default;
|
|
|
|
# 1.1.1.2
|
|
# need TABLE so we can test FOR CHANNEL
|
|
SET GLOBAL master_info_repository = 'TABLE';
|
|
SET GLOBAL relay_log_info_repository = 'TABLE';
|
|
|
|
--disable_warnings
|
|
CHANGE MASTER TO MASTER_PASSWORD='azundris3',
|
|
MASTER_CONNECT_RETRY = 1, MASTER_HEARTBEAT_PERIOD = 1.01,
|
|
MASTER_LOG_FILE = 'master_log_name', MASTER_LOG_POS = 0,
|
|
MASTER_SSL = 0, MASTER_SSL_CA = 'ca_file_name',
|
|
MASTER_SSL_CAPATH = 'ca_directory_name',
|
|
MASTER_SSL_CERT = 'cert_file_name', MASTER_SSL_KEY = 'key_file_name',
|
|
MASTER_SSL_CIPHER = 'cipher_list', MASTER_SSL_VERIFY_SERVER_CERT = 1,
|
|
MASTER_SSL_CRL = 'crl_file_name', MASTER_SSL_CRLPATH = 'crl_directory_name',
|
|
IGNORE_SERVER_IDS = (99,100), MASTER_TLS_VERSION = 'TLSv1.2',
|
|
MASTER_BIND = 'eth4n', MASTER_RETRY_COUNT = 7,
|
|
MASTER_DELAY = 4711, MASTER_AUTO_POSITION = 0 FOR CHANNEL 'chan_jackie';
|
|
--enable_warnings
|
|
|
|
RESET SLAVE ALL;
|
|
SET GLOBAL master_info_repository = DEFAULT;
|
|
SET GLOBAL relay_log_info_repository = DEFAULT;
|
|
|
|
# 1.1.1.3
|
|
CREATE USER 'test_user4'@'localhost';
|
|
SET PASSWORD FOR 'test_user4'@'localhost' = 'azundris4';
|
|
|
|
# clean-up
|
|
SET SESSION long_query_time= @old_long_query_time;
|
|
SET GLOBAL slow_query_log='OFF';
|
|
|
|
DROP USER 'test_user4'@'localhost';
|
|
DROP USER test_user2;
|
|
|
|
let $wait_condition= SELECT sql_text FROM mysql.slow_log WHERE sql_text LIKE "%SET PASSWORD FOR `test_user4`@`localhost`%";
|
|
--source include/wait_condition.inc
|
|
|
|
# show slow-logging to file is correct
|
|
CREATE TABLE test_log (sql_text TEXT);
|
|
--replace_result $MYSQLTEST_VARDIR ...
|
|
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/log/rewrite_slow.log'
|
|
INTO TABLE test_log FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n';
|
|
|
|
# all passwords ('azundris%') must have been obfuscated -> empty result set
|
|
--echo This line should be followed by two SELECTs with empty result sets
|
|
SELECT sql_text FROM test_log WHERE sql_text LIKE CONCAT('%azun','dris%');
|
|
|
|
# same for logging to table
|
|
SELECT sql_text FROM mysql.slow_log WHERE sql_text LIKE CONCAT('%azun','dris%');
|
|
|
|
# WL#11544 verification : Replace clause should be seen in the log.
|
|
# In case of ps-protocol, it will be seen twice.
|
|
SELECT count(*)=1 OR count(*)=2 FROM mysql.slow_log WHERE sql_text LIKE '%REPLACE%';
|
|
|
|
--echo ------ from file ------
|
|
SELECT count(*)=1 OR count(*)=2 FROM test_log WHERE sql_text LIKE 'CREATE USER %' AND sql_text LIKE '%<secret>%';
|
|
SELECT sql_text FROM test_log WHERE sql_text LIKE 'CHANGE MASTER TO MASTER_BIND %';
|
|
SELECT count(*) FROM test_log WHERE sql_text LIKE 'SET PASSWORD %' AND sql_text LIKE '%<secret>%';
|
|
--echo ------ from table ------
|
|
SELECT count(*)=1 OR count(*)=2 FROM mysql.slow_log WHERE sql_text LIKE 'CREATE USER %' AND sql_text LIKE '%<secret>%';
|
|
SELECT sql_text FROM test_log WHERE sql_text LIKE 'CHANGE MASTER TO MASTER_BIND %';
|
|
SELECT count(*) FROM test_log WHERE sql_text LIKE 'SET PASSWORD %' AND sql_text LIKE '%<secret>%';
|
|
--echo ------ done ------
|
|
|
|
DROP TABLE test_log;
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/log/rewrite_slow.log
|
|
|
|
--echo End of 5.6 tests!
|
|
|
|
|
|
|
|
--echo #
|
|
--echo # Bug#16467055: GRANT STATEMENTS LOGGED TWICE IN SLOW QUERY LOG
|
|
--echo #
|
|
|
|
SET SESSION long_query_time= 0;
|
|
SET GLOBAL slow_query_log = 1;
|
|
SET GLOBAL log_output = 'TABLE';
|
|
|
|
TRUNCATE mysql.slow_log;
|
|
|
|
--exec $MYSQL -e "SET SESSION long_query_time=0; CREATE USER u16467055 IDENTIFIED BY 'meow';" test
|
|
let $wait_condition= SELECT "slow -->", sql_text FROM mysql.slow_log WHERE sql_text LIKE "%USER 'u16467055'%";
|
|
--source include/wait_condition.inc
|
|
|
|
DROP USER u16467055;
|
|
|
|
|
|
|
|
--echo End of 5.7 tests!
|
|
|
|
# clean-up
|
|
SET SESSION long_query_time= @old_long_query_time;
|
|
SET GLOBAL slow_query_log_file=@old_slow_query_log_file;
|
|
SET GLOBAL slow_query_log= @old_slow_query_log;
|
|
SET GLOBAL log_output= @old_log_output;
|
|
--disable_warnings
|
|
SET GLOBAL master_info_repository= @old_master_info_repository;
|
|
SET GLOBAL relay_log_info_repository= @old_relay_log_info_repository;
|
|
--enable_warnings
|
|
|
|
--source suite/xengine/include/check_xengine_log_error.inc
|