1 #!/bin/sh 2 # 3 # Test multiple certificates (SNI) on a listening socket. 4 5 . hitch_test.sh 6 7 start_hitch \ 8 --backend='[hitch-tls.org]:80' \ 9 --frontend="[localhost]:$LISTENPORT" \ 10 "${CERTSDIR}/site1.example.com" \ 11 "${CERTSDIR}/site2.example.com" \ 12 "${CERTSDIR}/default.example.com" 13 14 s_client >no-sni.dump 15 subject_field_eq CN "default.example.com" no-sni.dump 16 17 # send a SNI request 18 s_client -servername site1.example.com >sni.dump 19 subject_field_eq CN "site1.example.com" sni.dump 20 21 curl_hitch 22 23 stop_hitch 24 25 cat >hitch.cfg <<EOF 26 frontend = { 27 host = "localhost" 28 port = "$LISTENPORT" 29 30 pem-file = "${CERTSDIR}/site1.example.com" 31 pem-file = "${CERTSDIR}/site2.example.com" 32 pem-file = "${CERTSDIR}/default.example.com" 33 } 34 35 backend = "[hitch-tls.org]:80" 36 EOF 37 38 start_hitch --config=hitch.cfg 39 40 s_client >cfg-no-sni.dump 41 subject_field_eq CN "default.example.com" cfg-no-sni.dump 42 43 s_client -servername site1.example.com >cfg-sni.dump 44 subject_field_eq CN "site1.example.com" cfg-sni.dump 45 46 s_client -servername SITE1.EXAMPLE.COM >cfg-sni-upper.dump 47 subject_field_eq CN "site1.example.com" cfg-sni-upper.dump