1 #!/bin/sh 2 # 3 # Test pem-dir & pem-dir-glob options 4 # 5 . hitch_test.sh 6 cat >hitch.cfg <<EOF 7 frontend = { 8 host = "localhost" 9 port = "$LISTENPORT" 10 } 11 12 pem-dir = "${CERTSDIR}/pemdirtest" 13 sni-nomatch-abort = on 14 EOF 15 16 start_hitch --config=hitch.cfg 17 18 19 if openssl s_client -help 2>&1 | grep -q -e -noservername; 20 then 21 NOSNI="-noservername" 22 else 23 NOSNI="" 24 fi 25 26 s_client -servername site1.example.com -connect localhost:$LISTENPORT >site1.dump 27 subject_field_eq CN "site1.example.com" site1.dump 28 29 s_client -servername site2.example.com -connect localhost:$LISTENPORT >site2.dump 30 subject_field_eq CN "site2.example.com" site2.dump 31 32 s_client -servername default.example.com -connect localhost:$LISTENPORT >default.dump 33 subject_field_eq CN "default.example.com" default.dump 34 35 ! s_client -servername invalid.example.com -connect localhost:$LISTENPORT >unknown.dump 36 run_cmd grep 'unrecognized name' unknown.dump 37 38 39 stop_hitch 40 cat >hitch.cfg <<EOF 41 frontend = { 42 host = "localhost" 43 port = "$LISTENPORT" 44 } 45 46 pem-dir = "${CERTSDIR}/pemdirtest" 47 pem-dir-glob = "*site*" 48 sni-nomatch-abort = on 49 EOF 50 51 start_hitch --config=hitch.cfg 52 53 s_client -servername site1.example.com -connect localhost:$LISTENPORT >site1.dump 54 subject_field_eq CN "site1.example.com" site1.dump 55 56 s_client -servername site2.example.com -connect localhost:$LISTENPORT >site2.dump 57 subject_field_eq CN "site2.example.com" site2.dump 58 59 s_client -servername site3.example.com -connect localhost:$LISTENPORT >site3.dump 60 subject_field_eq CN "site3.example.com" site3.dump 61 62 ! s_client -servername default.example.com -connect localhost:$LISTENPORT >default.dump 63 run_cmd grep 'unrecognized name' unknown.dump 64 65 s_client $NOSNI >cfg-no-sni.dump 66 subject_field_eq CN "site1.example.com" cfg-no-sni.dump 67