-#!/bin/bash
+#!/bin/sh
# Copyright (C) 2010 Free Software Foundation, Inc.
#
echo "Checking DSA-1024 with TLS 1.0"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI $DEBUG -p $PORT 127.0.0.1 --insecure --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem </dev/null >/dev/null 2>&1 && \
fail "Succeeded connection to a server with a client DSA 3072 key and TLS 1.0!"
-kill %1
+kill $PID
wait
# DSA 1024 + TLS 1.2
echo "Checking DSA-1024 with TLS 1.2"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.1024.pem --x509keyfile $srcdir/dsa.1024.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
fail "Failed connection to a server with a client DSA 3072 key and TLS 1.2!"
-kill %1
+kill $PID
wait
# DSA 2048 + TLS 1.0
echo "Checking DSA-2048 with TLS 1.0"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
fail "Succeeded connection to a server with DSA 2048 key and TLS 1.0. Should have failed!"
-kill %1
+kill $PID
wait
# DSA 2048 + TLS 1.2
echo "Checking DSA-2048 with TLS 1.2"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.2048.pem --x509keyfile $srcdir/dsa.2048.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
fail "Failed connection to a server with DSA 2048 key and TLS 1.2!"
-kill %1
+kill $PID
wait
# DSA 3072 + TLS 1.0
echo "Checking DSA-3072 with TLS 1.0"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.0" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null 2>&1 && \
fail "Succeeded connection to a server with DSA 2048 key and TLS 1.0. Should have failed!"
-kill %1
+kill $PID
wait
# DSA 3072 + TLS 1.2
echo "Checking DSA-3072 with TLS 1.2"
-$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 &
+$SERV $DEBUG -p $PORT --priority "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2" --x509certfile $srcdir/cert.dsa.3072.pem --x509keyfile $srcdir/dsa.3072.pem >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI $DEBUG -p $PORT 127.0.0.1 --insecure </dev/null >/dev/null || \
fail "Failed connection to a server with DSA 3072 key and TLS 1.2!"
-kill %1
+kill $PID
wait
exit 0
-#!/bin/bash
+#!/bin/sh
# Copyright (C) 2010 Free Software Foundation, Inc.
#
echo "Checking OpenPGP certificate verification"
-$SERV -p $PORT --pgpcertfile $srcdir/srv-public-127.0.0.1-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 &
+$SERV -p $PORT --pgpcertfile $srcdir/srv-public-127.0.0.1-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
# give the server a chance to initialize
sleep 2
$CLI -p $PORT localhost --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null && \
fail "Connection to unverified (but present) 'localhost' should have failed!"
-kill %1
+kill $PID
wait
-$SERV -p $PORT --pgpcertfile $srcdir/srv-public-localhost-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 &
+$SERV -p $PORT --pgpcertfile $srcdir/srv-public-localhost-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
+
# give the server a chance to initialize
sleep 2
#$CLI -p $PORT localhost --pgpkeyring ca-public.gpg </dev/null >/dev/null || \
# fail "Connection to verified 'localhost' should have succeded! (error code $?)" $?
-kill %1 >/dev/null 2>&1
+kill $PID
wait
-$SERV -p $PORT --pgpcertfile $srcdir/srv-public-all-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 &
+$SERV -p $PORT --pgpcertfile $srcdir/srv-public-all-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
+trap "kill $PID" 1 15 2
+
# give the server a chance to initialize
sleep 2
echo | $CLI -p $PORT 127.0.0.1 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null || \
$CLI -p $PORT 127.0.0.2 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null && \
fail "Connection to unrecognized IP address should have failed!"
-kill %1 >/dev/null 2>&1
+kill $PID
wait
exit ${RETCODE:-0}