blob: f97bf4de3a5390b0716dcbd529672cc395c87e04 [file] [log] [blame]
William Dauchyf6370442020-11-14 19:25:33 +01001varnishtest "Set server ssl via CLI"
2
3feature ignore_unknown_macro
4
5# for "set server <srv> ssl"
6#REQUIRE_VERSION=2.4
William Lallemanda1ef7542020-11-18 17:41:28 +01007#REGTEST_TYPE=devel
8#REQUIRE_OPTIONS=OPENSSL
William Dauchyf6370442020-11-14 19:25:33 +01009
10# Do nothing. Is there only to create s1_* macros
11server s1 {
12} -start
13
14haproxy h1 -conf {
15 global
16 ssl-server-verify none
17
18 defaults
19 mode http
20 ${no-htx} option http-use-htx
21 timeout connect 1s
22 timeout client 1s
23 timeout server 1s
24
25 frontend myfrontend
26 bind "fd@${my_fe}"
27 default_backend test0
28
29 backend test0
William Dauchyf6370442020-11-14 19:25:33 +010030 server www0 ${s1_addr}:${s1_port} no-ssl
Christopher Faulet7cbd1562021-12-01 09:50:41 +010031 default-server ssl
32 server www1 ${s1_addr}:${s1_port} no-ssl
William Dauchyf6370442020-11-14 19:25:33 +010033
34 backend test1
35 server www0 ${s1_addr}:${s1_port} no-ssl
36} -start
37
38haproxy h1 -cli {
39 # supported case
40 send "show servers state test0"
Christopher Faulet7cbd1562021-12-01 09:50:41 +010041 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - -1"
42 send "set server test0/www1 ssl on"
William Dauchyf6370442020-11-14 19:25:33 +010043 expect ~ "server ssl setting updated"
44 send "show servers state test0"
Christopher Faulet7cbd1562021-12-01 09:50:41 +010045 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 1"
46 send "set server test0/www1 ssl off"
William Dauchyf6370442020-11-14 19:25:33 +010047 expect ~ "server ssl setting updated"
48 send "show servers state test0"
Christopher Faulet7cbd1562021-12-01 09:50:41 +010049 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 0"
50
51 # unsupported cases
52 send "show servers state test0"
53 expect ~ "test0 1 www0 ${s1_addr} .* - ${s1_port} - -1"
54 send "set server test0/www0 ssl on"
55 expect ~ "'set server <srv> ssl' cannot be set"
William Dauchyf6370442020-11-14 19:25:33 +010056
William Dauchyf6370442020-11-14 19:25:33 +010057 send "show servers state test1"
58 expect ~ "test1 1 www0 ${s1_addr} .* - ${s1_port} - -1"
59 send "set server test1/www0 ssl on"
60 expect ~ "'set server <srv> ssl' cannot be set"
61} -wait