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 |
| 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 Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 30 | server www0 ${s1_addr}:${s1_port} no-ssl |
Christopher Faulet | 7cbd156 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 31 | default-server ssl |
| 32 | server www1 ${s1_addr}:${s1_port} no-ssl |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 33 | |
| 34 | backend test1 |
| 35 | server www0 ${s1_addr}:${s1_port} no-ssl |
| 36 | } -start |
| 37 | |
| 38 | haproxy h1 -cli { |
| 39 | # supported case |
| 40 | send "show servers state test0" |
Christopher Faulet | 7cbd156 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 41 | expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - -1" |
| 42 | send "set server test0/www1 ssl on" |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 43 | expect ~ "server ssl setting updated" |
| 44 | send "show servers state test0" |
Christopher Faulet | 7cbd156 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 45 | expect ~ "test0 2 www1 ${s1_addr} .* - ${s1_port} - 1" |
| 46 | send "set server test0/www1 ssl off" |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 47 | expect ~ "server ssl setting updated" |
| 48 | send "show servers state test0" |
Christopher Faulet | 7cbd156 | 2021-12-01 09:50:41 +0100 | [diff] [blame] | 49 | 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 Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 56 | |
William Dauchy | f637044 | 2020-11-14 19:25:33 +0100 | [diff] [blame] | 57 | 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 |