"Fossies" - the Fresh Open Source Software Archive

Member "hitch-1.7.2/src/tests/test10-dflt-certs.sh" (29 Nov 2021, 1538 Bytes) of package /linux/www/hitch-1.7.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test10-dflt-certs.sh": 1.7.0_vs_1.7.2.

    1 #!/bin/sh
    2 
    3 . hitch_test.sh
    4 
    5 PORT1=$(expr $$ % 60000 + 1024)
    6 PORT2=$(expr $$ % 60000 + 2048)
    7 PORT3=$(expr $$ % 60000 + 3072)
    8 PORT4=$(expr $$ % 60000 + 4096)
    9 
   10 cat >hitch.cfg <<EOF
   11 pem-file = "${CERTSDIR}/site1.example.com"
   12 pem-file = "${CERTSDIR}/site3.example.com"
   13 pem-file = "${CERTSDIR}/default.example.com"
   14 backend = "[hitch-tls.org]:80"
   15 
   16 frontend = {
   17      host = "localhost"
   18      port = "$PORT1"
   19      pem-file = "${CERTSDIR}/site1.example.com"
   20 }
   21 
   22 frontend = {
   23      host = "localhost"
   24      port = "$PORT2"
   25      pem-file = "${CERTSDIR}/site2.example.com"
   26      match-global-certs = on
   27 }
   28 
   29 frontend = {
   30      host = "localhost"
   31      port = "$PORT3"
   32      pem-file = "${CERTSDIR}/site3.example.com"
   33 }
   34 
   35 frontend = {
   36      host = "localhost"
   37      port = "$PORT4"
   38 }
   39 EOF
   40 
   41 start_hitch --config=hitch.cfg
   42 
   43 # :PORT1 without SNI
   44 s_client -connect localhost:$PORT1 >port1-no-sni.dump
   45 subject_field_eq CN "site1.example.com" port1-no-sni.dump
   46 
   47 # :PORT1 w/ SNI
   48 s_client -servername site1.example.com \
   49     -connect localhost:$PORT1 \
   50     >port1-sni.dump
   51 subject_field_eq CN "site1.example.com" port1-sni.dump
   52 
   53 # :PORT1 w/ different matching SNI name
   54 s_client -servername site3.example.com \
   55     -connect localhost:$PORT2 \
   56     >port1-sni2.dump
   57 subject_field_eq CN "site3.example.com" port1-sni2.dump
   58 
   59 # :PORT2 no SNI
   60 s_client -connect localhost:$PORT2 >port2-no-sni.dump
   61 subject_field_eq CN "site2.example.com" port2-no-sni.dump
   62 
   63 # :PORT4 SNI w/ unknown servername
   64 s_client -servername invalid.example.com \
   65     -connect localhost:$PORT4 \
   66     >port4.dump
   67 subject_field_eq CN "default.example.com" port4.dump