| 1 |
** Setup ** |
| 2 |
|
| 3 |
SET @old_log_output= @@global.log_output; |
| 4 |
SET @old_general_log= @@global.general_log; |
| 5 |
SET @old_general_log_file= @@global.general_log_file; |
| 6 |
SET GLOBAL general_log_file = '.../log/proxy_general.log'; |
| 7 |
SET GLOBAL log_output = 'FILE,TABLE'; |
| 8 |
SET GLOBAL general_log= 'ON'; |
| 9 |
SET @default_sha256_password_proxy_users = @@global.sha256_password_proxy_users; |
| 10 |
SET @default_check_proxy_users = @@global.check_proxy_users; |
| 11 |
'#----- 2.1.12.1 Test of general log entries. -------------------#' |
| 12 |
SET Global sha256_password_proxy_users=OFF; |
| 13 |
** Creating new base user ** |
| 14 |
CREATE USER proxy_base@localhost; |
| 15 |
GRANT ALTER ON *.* TO proxy_base@localhost; |
| 16 |
** Creating new proxy user ** |
| 17 |
CREATE USER proxy_sha256@localhost IDENTIFIED WITH sha256_password; |
| 18 |
GRANT CREATE ON *.* TO proxy_sha256@localhost; |
| 19 |
GRANT PROXY ON proxy_base@localhost TO proxy_sha256@localhost; |
| 20 |
SET Global sha256_password_proxy_users=ON; |
| 21 |
** Connecting as proxy_sha256 with proxy mapping disabled (native mapping on) ** |
| 22 |
SELECT CURRENT_USER(), USER(), @@session.proxy_user; |
| 23 |
CURRENT_USER() USER() @@session.proxy_user |
| 24 |
proxy_sha256@localhost proxy_sha256@localhost NULL |
| 25 |
SHOW GRANTS; |
| 26 |
Grants for proxy_sha256@localhost |
| 27 |
GRANT CREATE ON *.* TO `proxy_sha256`@`localhost` |
| 28 |
GRANT PROXY ON `proxy_base`@`localhost` TO `proxy_sha256`@`localhost` |
| 29 |
** Connection default ** |
| 30 |
** Disconnecting connections ** |
| 31 |
SET Global check_proxy_users=ON; |
| 32 |
** Connecting as proxy_sha256 with proxy mapping enabled ** |
| 33 |
SELECT CURRENT_USER(), USER(), @@session.proxy_user; |
| 34 |
CURRENT_USER() USER() @@session.proxy_user |
| 35 |
proxy_base@localhost proxy_sha256@localhost 'proxy_sha256'@'localhost' |
| 36 |
SHOW GRANTS; |
| 37 |
Grants for proxy_base@localhost |
| 38 |
GRANT ALTER ON *.* TO `proxy_base`@`localhost` |
| 39 |
** Disconnecting connections ** |
| 40 |
SET GLOBAL general_log= 'OFF'; |
| 41 |
CREATE TABLE test_log (argument TEXT); |
| 42 |
LOAD DATA LOCAL INFILE '.../log/proxy_general.log' |
| 43 |
INTO TABLE test_log FIELDS TERMINATED BY '\n' LINES TERMINATED BY '\n'; |
| 44 |
SELECT count(argument) FROM test_log |
| 45 |
WHERE argument LIKE '%proxy_sha256@localhost on test%'; |
| 46 |
count(argument) |
| 47 |
1 |
| 48 |
SELECT count(argument) FROM test_log |
| 49 |
WHERE argument LIKE '%proxy_sha256@localhost as proxy_base on test%'; |
| 50 |
count(argument) |
| 51 |
1 |
| 52 |
DROP TABLE test_log; |
| 53 |
DROP USER proxy_base@localhost; |
| 54 |
DROP USER proxy_sha256@localhost; |
| 55 |
SET @@global.sha256_password_proxy_users = @default_sha256_password_proxy_users; |
| 56 |
SET @@global.check_proxy_users = @default_check_proxy_users; |
| 57 |
SET GLOBAL general_log_file= @old_general_log_file; |
| 58 |
SET GLOBAL general_log= @old_general_log; |
| 59 |
SET GLOBAL log_output= @old_log_output; |
| 60 |
TRUNCATE TABLE mysql.general_log; |