1# #-- stream_ssl.test --# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8. ../common.sh 9get_make 10(cd $PRE; $MAKE streamtcp) 11 12# first test streamtcp against the server unbound. 13echo "> streamtcp -s www.example.com A IN" 14$PRE/streamtcp -s -f 127.0.0.1@$SERV_PORT www.example.com. A IN >outfile 2>outerr 15if test "$?" -ne 0; then 16 echo "exit status not OK" 17 echo "> cat logfiles" 18 cat outfile 19 cat outerr 20 echo "SSLSERVICE" 21 cat unboundserv.log 22 echo "SSLCLIENT" 23 cat unboundclie.log 24 echo "Not OK" 25 exit 1 26else 27 echo "exit status OK" 28fi 29echo "> cat logfiles" 30cat outfile 31cat outerr 32echo "SSLSERVICE" 33cat unboundserv.log 34echo "SSLCLIENT" 35cat unboundclie.log 36echo "> check answer" 37if grep "10.20.30.40" outfile; then 38 echo "OK" 39else 40 echo "Not OK" 41 exit 1 42fi 43 44rm -f outfile 45 46# test client unbound (no SSL towards it, but it does SSL to the SSL service) 47echo "> dig www.example.com A IN" 48dig @127.0.0.1 -p $CLIE_PORT www.example.com. >outfile 2>&1 49if test "$?" -ne 0; then 50 echo "exit status not OK" 51 echo "> cat logfiles" 52 cat outfile 53 echo "SSLSERVICE" 54 cat unboundserv.log 55 echo "SSLCLIENT" 56 cat unboundclie.log 57 echo "Not OK" 58 exit 1 59else 60 echo "exit status OK" 61fi 62echo "> cat logfiles" 63cat outfile 64echo "SSLSERVICE" 65cat unboundserv.log 66echo "SSLCLIENT" 67cat unboundclie.log 68echo "> check answer" 69if grep "10.20.30.40" outfile; then 70 echo "OK" 71else 72 echo "Not OK" 73 exit 1 74fi 75 76rm -f outfile 77 78# test client unbound (no SSL towards it, but it does SSL to the SSL service) 79# test that forward-host notation also works. 80echo "> dig test.host. A IN" 81dig @127.0.0.1 -p $CLIE_PORT test.host. >outfile 2>&1 82if test "$?" -ne 0; then 83 echo "exit status not OK" 84 echo "> cat logfiles" 85 cat outfile 86 echo "SSLSERVICE" 87 cat unboundserv.log 88 echo "SSLCLIENT" 89 cat unboundclie.log 90 echo "Not OK" 91 exit 1 92else 93 echo "exit status OK" 94fi 95echo "> cat logfiles" 96cat outfile 97echo "SSLSERVICE" 98cat unboundserv.log 99echo "SSLCLIENT" 100cat unboundclie.log 101echo "> check answer" 102if grep "1.2.3.4" outfile; then 103 echo "OK" 104else 105 echo "Not OK" 106 exit 1 107fi 108 109rm -f outfile 110exit 0 111