proxy-ca-key.pem proxy-ca.pem proxy-invalid.pem proxy-key.pem
}
stop_servers() {
- pkill -n gnutls-serv
- pkill -n tlsproxy
+ kill $pid_server || echo 'failed to kill gnutls-serv'
+ kill $pid_tlsproxy || echo 'failed to kill tlsproxy'
}
abort() {
echo "abort: $*"
stop_servers
exit 1
}
+tlsproxy() {
+ ../src/tlsproxy -d2 "$@" >/dev/null &
+ pid_tlsproxy=$!
+}
server() {
gnutls-serv --http --port 4712 "$@" >/dev/null 2>&1 &
+ pid_server=$!
}
client() {
./client ./proxy-ca.pem "$@" > tmp 2>&1
"$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null
# Normal tests.
-../src/tlsproxy -d2 4711 >/dev/null &
+tlsproxy 4711
server --x509certfile "$srcdir/server.pem" \
--x509keyfile "$srcdir/server-key.pem"
sleep 1
# Stop server and try a "MITM" with a bad certificate.
echo
-pkill -n gnutls-serv
+kill $pid_server || echo 'failed to kill gnutls-serv'
server --x509certfile "$srcdir/server-bad.pem" \
--x509keyfile "$srcdir/server-key.pem"
sleep 1
"$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null
# Normal tests.
-../src/tlsproxy -d2 -u 4711 >/dev/null &
+tlsproxy -u 4711
server --x509certfile "$srcdir/server.pem" \
--x509keyfile "$srcdir/server-key.pem"
sleep 1
# Stop server and try a "MITM" with a bad certificate.
echo
-pkill -n gnutls-serv
+kill $pid_server || echo 'failed to kill gnutls-serv'
server --x509certfile "$srcdir/server-bad.pem" \
--x509keyfile "$srcdir/server-key.pem"
sleep 1