Frédéric Lécaille | 0656d9c | 2018-12-18 10:31:04 +0100 | [diff] [blame] | 1 | varnishtest "Health-check test over TLS/SSL" |
Ilya Shipitsin | 9ab3138 | 2019-04-17 12:19:56 +0500 | [diff] [blame] | 2 | #REQUIRE_OPTIONS=OPENSSL |
Willy Tarreau | 8e8bd88 | 2019-05-17 17:15:20 +0200 | [diff] [blame] | 3 | #REGTEST_TYPE=slow |
Frédéric Lécaille | 0656d9c | 2018-12-18 10:31:04 +0100 | [diff] [blame] | 4 | feature ignore_unknown_macro |
| 5 | |
| 6 | |
| 7 | # This script tests health-checks for a TLS/SSL backend with "option httpchk" |
| 8 | # and "check-ssl" option enabled attached to h2 haproxy process. This haproxy |
| 9 | # h2 process is chained to h1 other one. |
| 10 | # |
| 11 | server s1 { |
| 12 | rxreq |
| 13 | expect req.method == OPTIONS |
| 14 | expect req.url == * |
| 15 | expect req.proto == HTTP/1.1 |
| 16 | txresp |
| 17 | } -start |
| 18 | |
| 19 | server s2 { |
| 20 | } -start |
| 21 | |
| 22 | syslog S1 -level notice { |
| 23 | recv |
| 24 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: Proxy fe1 started." |
| 25 | recv info |
| 26 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* fe1~ be1/srv1 .* 200 [[:digit:]]+ - - ---- .* \"OPTIONS \\* HTTP/1.1\"" |
| 27 | recv info |
| 28 | expect ~ "[^:\\[ ]\\[${h1_pid}\\]: .* fe1~ be1/srv1 .* 504 [[:digit:]]+ - - sH-- .* \"OPTIONS \\* HTTP/1.1\"" |
| 29 | } -start |
| 30 | |
| 31 | haproxy h1 -conf { |
| 32 | global |
| 33 | tune.ssl.default-dh-param 2048 |
| 34 | |
| 35 | defaults |
| 36 | mode http |
Willy Tarreau | 2eb1c79 | 2019-05-07 07:26:08 +0200 | [diff] [blame] | 37 | timeout client 20 |
| 38 | timeout server 20 |
| 39 | timeout connect 20 |
Frédéric Lécaille | 0656d9c | 2018-12-18 10:31:04 +0100 | [diff] [blame] | 40 | |
| 41 | backend be1 |
| 42 | server srv1 ${s1_addr}:${s1_port} |
| 43 | |
| 44 | backend be2 |
| 45 | server srv2 ${s2_addr}:${s2_port} |
| 46 | |
| 47 | frontend fe1 |
| 48 | option httplog |
| 49 | log ${S1_addr}:${S1_port} len 2048 local0 debug err |
| 50 | bind "fd@${fe1}" ssl crt ${testdir}/common.pem |
| 51 | use_backend be1 |
| 52 | |
| 53 | frontend fe2 |
| 54 | option tcplog |
| 55 | bind "fd@${fe2}" ssl crt ${testdir}/common.pem |
| 56 | use_backend be2 |
| 57 | } -start |
| 58 | |
| 59 | syslog S2 -level notice { |
| 60 | recv |
| 61 | expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Proxy be2 started." |
| 62 | recv |
| 63 | expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be2/srv1 succeeded, reason: Layer7 check passed, code: 200, info: \"OK\", check duration: [[:digit:]]+ms, status: 1/1 UP." |
| 64 | recv |
| 65 | expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be2/srv1 failed, reason: Layer7 wrong status, code: 504, info: \"Gateway Time-out\", check duration: [[:digit:]]+ms, status: 0/1 DOWN." |
| 66 | } -start |
| 67 | |
| 68 | syslog S4 -level notice { |
| 69 | recv |
| 70 | expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Proxy be4 started." |
| 71 | recv |
| 72 | expect ~ "[^:\\[ ]\\[${h2_pid}\\]: Health check for server be4/srv2 succeeded, reason: Layer6 check passed, check duration: [[:digit:]]+ms, status: 1/1 UP." |
| 73 | } -start |
| 74 | |
| 75 | haproxy h2 -conf { |
| 76 | global |
| 77 | tune.ssl.default-dh-param 2048 |
| 78 | |
| 79 | defaults |
Willy Tarreau | 2eb1c79 | 2019-05-07 07:26:08 +0200 | [diff] [blame] | 80 | timeout client 20 |
| 81 | timeout server 20 |
| 82 | timeout connect 20 |
Willy Tarreau | 8e8bd88 | 2019-05-17 17:15:20 +0200 | [diff] [blame] | 83 | default-server downinter 1s inter 500 rise 1 fall 1 |
Frédéric Lécaille | 0656d9c | 2018-12-18 10:31:04 +0100 | [diff] [blame] | 84 | |
| 85 | backend be2 |
| 86 | option log-health-checks |
| 87 | option httpchk OPTIONS * HTTP/1.1\r\nHost:\ www |
| 88 | log ${S2_addr}:${S2_port} daemon |
| 89 | server srv1 ${h1_fe1_addr}:${h1_fe1_port} ssl crt ${testdir}/common.pem verify none check |
| 90 | |
| 91 | backend be4 |
| 92 | option log-health-checks |
| 93 | log ${S4_addr}:${S4_port} daemon |
| 94 | server srv2 ${h1_fe2_addr}:${h1_fe2_port} ssl crt ${testdir}/common.pem verify none check-ssl check |
| 95 | } -start |
| 96 | |
| 97 | syslog S1 -wait |
| 98 | |
| 99 | syslog S2 -wait |
| 100 | syslog S4 -wait |
| 101 | |