blob: e94a37a87f2169bcc8adfead8af432c397fad0aa [file] [log] [blame]
William Lallemand6e56b2c2020-06-26 11:29:43 +02001#REGTEST_TYPE=devel
2
3varnishtest "Test the ssl_f_* sample fetches"
William Lallemand6e56b2c2020-06-26 11:29:43 +02004#REQUIRE_OPTIONS=OPENSSL
5feature ignore_unknown_macro
6
7server s1 -repeat 3 {
8 rxreq
9 txresp
10} -start
11
12haproxy h1 -conf {
13 global
14 tune.ssl.default-dh-param 2048
Marcin Deranek310a2602021-07-13 19:04:24 +020015 tune.ssl.capture-buffer-size 1
William Lallemand6e56b2c2020-06-26 11:29:43 +020016 crt-base ${testdir}
17
18 defaults
19 mode http
20 option httplog
William Lallemand6e56b2c2020-06-26 11:29:43 +020021 log stderr local0 debug err
22 option logasap
Willy Tarreauf6739232021-11-18 17:46:22 +010023 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
24 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
25 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
William Lallemand6e56b2c2020-06-26 11:29:43 +020026
27
28 listen clear-lst
29 bind "fd@${clearlst}"
30 balance roundrobin
31 server s1 "${tmpdir}/ssl.sock" ssl verify none
32
33 listen ssl-lst
34 mode http
William Lallemand6e56b2c2020-06-26 11:29:43 +020035
36 http-response add-header x-ssl-der %[ssl_f_der,hex]
37 http-response add-header x-ssl-sha1 %[ssl_f_sha1,hex]
38 http-response add-header x-ssl-notafter %[ssl_f_notafter]
39 http-response add-header x-ssl-notbefore %[ssl_f_notbefore]
40 http-response add-header x-ssl-sig_alg %[ssl_f_sig_alg]
41 http-response add-header x-ssl-i_dn %[ssl_f_i_dn]
42 http-response add-header x-ssl-s_dn %[ssl_f_s_dn]
43 http-response add-header x-ssl-s_serial %[ssl_f_serial,hex]
44 http-response add-header x-ssl-key_alg %[ssl_f_key_alg]
45 http-response add-header x-ssl-version %[ssl_f_version]
46
47 bind "${tmpdir}/ssl.sock" ssl crt ${testdir}/common.pem
48
49 server s1 ${s1_addr}:${s1_port}
50} -start
51
52
53client c1 -connect ${h1_clearlst_sock} {
54 txreq
55 rxresp
56 expect resp.status == 200
57 expect resp.http.x-ssl-der ~ 3082067930820461A0030201020201.*207B5E3D4498BB847BC4DE093F9AD1AD3661C93EE43EB
58 expect resp.http.x-ssl-sha1 == "2195C9F0FD58470313013FC27C1B9CF9864BD1C6"
59 expect resp.http.x-ssl-notafter == "180116230238Z"
60 expect resp.http.x-ssl-notbefore == "160117230238Z"
61 expect resp.http.x-ssl-sig_alg == "RSA-SHA256"
62 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"
63 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"
64 expect resp.http.x-ssl-s_serial == "02"
65 expect resp.http.x-ssl-key_alg == "rsaEncryption"
66 expect resp.http.x-ssl-version == "3"
67} -run
68
69