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" |
Christopher Faulet | c300747 | 2020-11-13 17:10:51 +0100 | [diff] [blame] | 4 | #REQUIRE_VERSION=2.2 |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 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 |
Marcin Deranek | 310a260 | 2021-07-13 19:04:24 +0200 | [diff] [blame] | 16 | tune.ssl.capture-buffer-size 1 |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 17 | crt-base ${testdir} |
| 18 | stats socket "${tmpdir}/h1/stats" level admin |
| 19 | |
| 20 | defaults |
| 21 | mode http |
| 22 | option httplog |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 23 | log stderr local0 debug err |
| 24 | option logasap |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame^] | 25 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 26 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 27 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 28 | |
| 29 | |
| 30 | listen clear-lst |
| 31 | bind "fd@${clearlst}" |
| 32 | balance roundrobin |
| 33 | http-response add-header x-ssl-sha1 %[ssl_s_sha1,hex] |
| 34 | http-response add-header x-ssl-notafter %[ssl_s_notafter] |
| 35 | http-response add-header x-ssl-notbefore %[ssl_s_notbefore] |
| 36 | http-response add-header x-ssl-sig_alg %[ssl_s_sig_alg] |
| 37 | http-response add-header x-ssl-i_dn %[ssl_s_i_dn] |
| 38 | http-response add-header x-ssl-s_dn %[ssl_s_s_dn] |
| 39 | http-response add-header x-ssl-s_serial %[ssl_s_serial,hex] |
| 40 | http-response add-header x-ssl-key_alg %[ssl_s_key_alg] |
| 41 | http-response add-header x-ssl-der %[ssl_s_der,hex] |
William Dauchy | a598b50 | 2020-08-06 18:11:38 +0200 | [diff] [blame] | 42 | http-response add-header x-ssl-chain-der %[ssl_s_chain_der,hex] |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 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 |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 49 | |
| 50 | bind "${tmpdir}/ssl.sock" ssl strict-sni crt-list ${testdir}/localhost.crt-list |
| 51 | |
| 52 | server s1 ${s1_addr}:${s1_port} |
| 53 | } -start |
| 54 | |
| 55 | |
| 56 | client c1 -connect ${h1_clearlst_sock} { |
| 57 | txreq |
| 58 | rxresp |
| 59 | expect resp.status == 200 |
| 60 | expect resp.http.x-ssl-sha1 == "2195C9F0FD58470313013FC27C1B9CF9864BD1C6" |
| 61 | expect resp.http.x-ssl-notafter == "180116230238Z" |
| 62 | expect resp.http.x-ssl-notbefore == "160117230238Z" |
| 63 | expect resp.http.x-ssl-sig_alg == "RSA-SHA256" |
| 64 | 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" |
| 65 | 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" |
| 66 | expect resp.http.x-ssl-s_serial == "02" |
| 67 | expect resp.http.x-ssl-key_alg == "rsaEncryption" |
| 68 | expect resp.http.x-ssl-version == "3" |
William Dauchy | a598b50 | 2020-08-06 18:11:38 +0200 | [diff] [blame] | 69 | expect resp.http.x-ssl-der ~ 3082067930820461A0030201020201.*5E3D4498BB847BC4DE093F9AD1AD3 |
| 70 | expect resp.http.x-ssl-chain-der ~ 3082067930820461A0030201020201.*527A6D6780A610484CE356C4C4E1C |
William Lallemand | bfa3e81 | 2020-06-25 20:07:18 +0200 | [diff] [blame] | 71 | } -run |
| 72 | |
| 73 | |