blob: ef88b61c74c4b5b58809d88766cd5590d6c3a51e (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# MDEV-28277: Checking for mandatory "/v1/" prefix in the URL
# The test presumes that the local vault is running at $VAULT_ADDR,
# and the token is configured in $VAULT_TOKEN.
--source include/have_innodb.inc
--source hashicorp_plugin.inc
--exec vault secrets disable bug > /dev/null
--exec vault secrets enable -path /bug -version=2 kv > /dev/null
--exec vault kv put /bug/1 data=01234567890123456789012345678901 > /dev/null
--source include/shutdown_mysqld.inc
--let $LOG_FILE=$MYSQLTEST_VARDIR/log/vault.err
--error 0,1
--remove_file $LOG_FILE
--let $vault_defaults=--plugin-load-add=hashicorp_key_management --hashicorp_key_management=force --hashicorp-key-management-check-kv-version=off --hashicorp-key-management-token=$VAULT_TOKEN
--let $defaults=--defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf $vault_defaults --log-error=$LOG_FILE
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd//"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="/abcd"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="abcd/v"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1b"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a/v1///"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="a///v1/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="///v1/a"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd//"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http:///abcd"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://abcd/v"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1b"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a/v1///"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://a///v1/"
--error 1
--exec $MYSQLD $defaults --hashicorp-key-management-vault-url="http://///v1/a"
--exec grep -oE "\[ERROR\] .*: hashicorp: .*" -- $LOG_FILE
--remove_file $LOG_FILE
--let $restart_parameters=$vault_defaults --hashicorp-key-management-vault-url=$VAULT_ADDR/v1/bug///
--let $restart_noprint=1
--source include/start_mysqld.inc
CREATE TABLE t1 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
INSERT INTO t1 VALUES ('foo'),('bar');
# Cleanup
DROP TABLE t1;
--let $restart_parameters=
--source include/restart_mysqld.inc
--exec vault secrets disable bug > /dev/null
|