William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 1 | varnishtest "Set server ssl via CLI" |
| 2 | |
| 3 | feature ignore_unknown_macro |
| 4 | |
| 5 | # for "set server <srv> ssl" |
| 6 | #REQUIRE_VERSION=2.4 |
William Lallemand | a1ef754 | 2020-11-18 17:41:28 +0100 | [diff] [blame] | 7 | #REGTEST_TYPE=devel |
| 8 | #REQUIRE_OPTIONS=OPENSSL |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 9 | |
| 10 | # Do nothing. Is there only to create s1_* macros |
| 11 | server s1 { |
| 12 | } -start |
| 13 | |
| 14 | haproxy h1 -conf { |
| 15 | global |
| 16 | ssl-server-verify none |
| 17 | |
| 18 | defaults |
| 19 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 20 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 21 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 22 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 23 | |
| 24 | frontend myfrontend |
| 25 | bind "fd@${my_fe}" |
| 26 | default_backend test0 |
| 27 | |
| 28 | backend test0 |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 29 | server www0 ${s1_addr}:${s1_port} no-ssl |
Christopher Faulet | 4ab2679 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 30 | default-server ssl |
| 31 | server www1 ${s1_addr}:${s1_port} no-ssl |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 32 | |
| 33 | backend test1 |
| 34 | server www0 ${s1_addr}:${s1_port} no-ssl |
| 35 | } -start |
| 36 | |
| 37 | haproxy h1 -cli { |
| 38 | # supported case |
| 39 | send "show servers state test0" |
Christopher Faulet | 4ab2679 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 40 | expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - -1" |
| 41 | send "set server test0/www1 ssl on" |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 42 | expect ~ "server ssl setting updated" |
| 43 | send "show servers state test0" |
Christopher Faulet | 4ab2679 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 44 | expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 1" |
| 45 | send "set server test0/www1 ssl off" |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 46 | expect ~ "server ssl setting updated" |
| 47 | send "show servers state test0" |
Christopher Faulet | 4ab2679 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 48 | 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 Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 55 | |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 56 | 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 |