#!/bin/sh STUNNEL=./debug/dist/build/tls-stunnel/tls-stunnel if [ ! -x ${STUNNEL} ]; then echo "hs-tls stunnel is not present, build with executable flag set." exit 1 fi PORT=$(($$ % 10000 + 10000)) if [ ! -f server.crt ]; then echo "generate some certificate \"server.crt\"" exit 2 fi if [ ! -f server.key ]; then echo "generate some private key \"server.key\"" exit 2 fi echo "running stunnel" ${STUNNEL} server -c server.crt -k server.key --source=localhost:${PORT} --destinationtype=fd --destination=2 > stunnel-gnutls-log 2>&1 & stunnelpid=$(pidof stunnel) STUNNELPID=$! sleep 1 echo "starting gnutls cli debug" gnutls-cli-debug localhost -p ${PORT} -VV kill ${STUNNELPID}