blob: ebfaad06577d5223054252842bafdb5b247fb557 [file] [log] [blame]
William Lallemandbfa3e812020-06-25 20:07:18 +02001#REGTEST_TYPE=devel
2
3varnishtest "Test the ssl_s_* sample fetches"
Christopher Fauletc3007472020-11-13 17:10:51 +01004#REQUIRE_VERSION=2.2
William Lallemandbfa3e812020-06-25 20:07:18 +02005#REQUIRE_OPTIONS=OPENSSL
6feature ignore_unknown_macro
7
8server s1 -repeat 3 {
9 rxreq
10 txresp
11} -start
12
13haproxy h1 -conf {
14 global
15 tune.ssl.default-dh-param 2048
Marcin Deranek310a2602021-07-13 19:04:24 +020016 tune.ssl.capture-buffer-size 1
William Lallemandbfa3e812020-06-25 20:07:18 +020017 crt-base ${testdir}
18 stats socket "${tmpdir}/h1/stats" level admin
19
20 defaults
21 mode http
22 option httplog
William Lallemandbfa3e812020-06-25 20:07:18 +020023 log stderr local0 debug err
24 option logasap
Willy Tarreauf6739232021-11-18 17:46:22 +010025 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
26 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
27 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
William Lallemandbfa3e812020-06-25 20:07:18 +020028
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 Dauchya598b502020-08-06 18:11:38 +020042 http-response add-header x-ssl-chain-der %[ssl_s_chain_der,hex]
William Lallemandbfa3e812020-06-25 20:07:18 +020043 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 Lallemandbfa3e812020-06-25 20:07:18 +020049
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
56client 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 Dauchya598b502020-08-06 18:11:38 +020069 expect resp.http.x-ssl-der ~ 3082067930820461A0030201020201.*5E3D4498BB847BC4DE093F9AD1AD3
70 expect resp.http.x-ssl-chain-der ~ 3082067930820461A0030201020201.*527A6D6780A610484CE356C4C4E1C
William Lallemandbfa3e812020-06-25 20:07:18 +020071} -run
72
73