blob: fa6fe68c5d89e42a127db5a16af55376bd6b8759 [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
Willy Tarreauf6739232021-11-18 17:46:22 +010020 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
21 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
22 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
William Dauchyf6370442020-11-14 19:25:33 +010023
24 frontend myfrontend
25 bind "fd@${my_fe}"
26 default_backend test0
27
28 backend test0
William Dauchyf6370442020-11-14 19:25:33 +010029 server www0 ${s1_addr}:${s1_port} no-ssl
Christopher Faulet4ab26792021-12-01 09:50:41 +010030 default-server ssl
31 server www1 ${s1_addr}:${s1_port} no-ssl
William Dauchyf6370442020-11-14 19:25:33 +010032
33 backend test1
34 server www0 ${s1_addr}:${s1_port} no-ssl
35} -start
36
37haproxy h1 -cli {
38 # supported case
39 send "show servers state test0"
Christopher Faulet4ab26792021-12-01 09:50:41 +010040 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - -1"
41 send "set server test0/www1 ssl on"
William Dauchyf6370442020-11-14 19:25:33 +010042 expect ~ "server ssl setting updated"
43 send "show servers state test0"
Christopher Faulet4ab26792021-12-01 09:50:41 +010044 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 1"
45 send "set server test0/www1 ssl off"
William Dauchyf6370442020-11-14 19:25:33 +010046 expect ~ "server ssl setting updated"
47 send "show servers state test0"
Christopher Faulet4ab26792021-12-01 09:50:41 +010048 expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 0"
49
50 # unsupported cases
51 send "show servers state test0"
52 expect ~ "test0 1 www0 ${s1_addr} .* - ${s1_port} - -1"
53 send "set server test0/www0 ssl on"
54 expect ~ "'set server <srv> ssl' cannot be set"
William Dauchyf6370442020-11-14 19:25:33 +010055
William Dauchyf6370442020-11-14 19:25:33 +010056 send "show servers state test1"
57 expect ~ "test1 1 www0 ${s1_addr} .* - ${s1_port} - -1"
58 send "set server test1/www0 ssl on"
59 expect ~ "'set server <srv> ssl' cannot be set"
60} -wait