blob: 5a7a0ee9b144e917c0367970a57316a11fab202b [file] [log] [blame]
William Lallemand15080cb2020-06-26 11:29:43 +02001#REGTEST_TYPE=devel
2
3varnishtest "Test the ssl_f_* sample fetches"
4#REQUIRE_VERSION=1.5
5#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
16 tune.ssl.capture-cipherlist-size 1
17 crt-base ${testdir}
18
19 defaults
20 mode http
21 option httplog
22 ${no-htx} option http-use-htx
23 log stderr local0 debug err
24 option logasap
25 timeout connect 1s
26 timeout client 1s
27 timeout server 1s
28
29
30 listen clear-lst
31 bind "fd@${clearlst}"
32 balance roundrobin
33 server s1 "${tmpdir}/ssl.sock" ssl verify none
34
35 listen ssl-lst
36 mode http
37 ${no-htx} option http-use-htx
38
39 http-response add-header x-ssl-der %[ssl_f_der,hex]
40 http-response add-header x-ssl-sha1 %[ssl_f_sha1,hex]
41 http-response add-header x-ssl-notafter %[ssl_f_notafter]
42 http-response add-header x-ssl-notbefore %[ssl_f_notbefore]
43 http-response add-header x-ssl-sig_alg %[ssl_f_sig_alg]
44 http-response add-header x-ssl-i_dn %[ssl_f_i_dn]
45 http-response add-header x-ssl-s_dn %[ssl_f_s_dn]
46 http-response add-header x-ssl-s_serial %[ssl_f_serial,hex]
47 http-response add-header x-ssl-key_alg %[ssl_f_key_alg]
48 http-response add-header x-ssl-version %[ssl_f_version]
49
50 bind "${tmpdir}/ssl.sock" ssl crt ${testdir}/common.pem
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-der ~ 3082067930820461A0030201020201.*207B5E3D4498BB847BC4DE093F9AD1AD3661C93EE43EB
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} -run
71
72