William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 1 | #REGTEST_TYPE=devel |
| 2 | |
| 3 | varnishtest "Test the ssl_s_* sample fetches" |
| 4 | #REQUIRE_VERSION=2.2 |
| 5 | #REQUIRE_OPTIONS=OPENSSL |
| 6 | feature ignore_unknown_macro |
| 7 | |
| 8 | server s1 -repeat 3 { |
| 9 | rxreq |
| 10 | txresp |
| 11 | } -start |
| 12 | |
| 13 | haproxy h1 -conf { |
| 14 | global |
| 15 | tune.ssl.default-dh-param 2048 |
| 16 | tune.ssl.capture-cipherlist-size 1 |
| 17 | crt-base ${testdir} |
| 18 | stats socket "${tmpdir}/h1/stats" level admin |
| 19 | |
| 20 | defaults |
| 21 | mode http |
| 22 | option httplog |
| 23 | ${no-htx} option http-use-htx |
| 24 | log stderr local0 debug err |
| 25 | option logasap |
| 26 | timeout connect 1s |
| 27 | timeout client 1s |
| 28 | timeout server 1s |
| 29 | |
| 30 | |
| 31 | listen clear-lst |
| 32 | bind "fd@${clearlst}" |
| 33 | balance roundrobin |
| 34 | http-response add-header x-ssl-sha1 %[ssl_s_sha1,hex] |
| 35 | http-response add-header x-ssl-notafter %[ssl_s_notafter] |
| 36 | http-response add-header x-ssl-notbefore %[ssl_s_notbefore] |
| 37 | http-response add-header x-ssl-sig_alg %[ssl_s_sig_alg] |
| 38 | http-response add-header x-ssl-i_dn %[ssl_s_i_dn] |
| 39 | http-response add-header x-ssl-s_dn %[ssl_s_s_dn] |
| 40 | http-response add-header x-ssl-s_serial %[ssl_s_serial,hex] |
| 41 | http-response add-header x-ssl-key_alg %[ssl_s_key_alg] |
| 42 | http-response add-header x-ssl-der %[ssl_s_der,hex] |
| 43 | http-response add-header x-ssl-version %[ssl_s_version] |
| 44 | |
| 45 | server s1 "${tmpdir}/ssl.sock" ssl verify none sni str(www.test1.com) |
| 46 | |
| 47 | listen ssl-lst |
| 48 | mode http |
| 49 | ${no-htx} option http-use-htx |
| 50 | |
| 51 | bind "${tmpdir}/ssl.sock" ssl strict-sni crt-list ${testdir}/localhost.crt-list |
| 52 | |
| 53 | server s1 ${s1_addr}:${s1_port} |
| 54 | } -start |
| 55 | |
| 56 | |
| 57 | client c1 -connect ${h1_clearlst_sock} { |
| 58 | txreq |
| 59 | rxresp |
| 60 | expect resp.status == 200 |
| 61 | expect resp.http.x-ssl-sha1 == "2195C9F0FD58470313013FC27C1B9CF9864BD1C6" |
| 62 | expect resp.http.x-ssl-notafter == "180116230238Z" |
| 63 | expect resp.http.x-ssl-notbefore == "160117230238Z" |
| 64 | expect resp.http.x-ssl-sig_alg == "RSA-SHA256" |
| 65 | expect resp.http.x-ssl-i_dn == "/C=FR/ST=Ile-de-France/L=Paris/O=ozon.io/CN=Ozon Test CA/emailAddress=support@ozon.io" |
| 66 | expect resp.http.x-ssl-s_dn == "/C=FR/ST=Ile-de-France/L=Neuilly-sur-Seine/O=TOAD Consulting/OU=eParapher Team/CN=www.test1.com/emailAddress=arnault.michel@toad-consulting.fr" |
| 67 | expect resp.http.x-ssl-s_serial == "02" |
| 68 | expect resp.http.x-ssl-key_alg == "rsaEncryption" |
| 69 | expect resp.http.x-ssl-version == "3" |
| 70 | expect resp.http.x-ssl-der ~ 3082067930820461A0030201020201.* |
| 71 | } -run |
| 72 | |
| 73 | |