mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
tests: openconnect binary is now set in variable
This commit is contained in:
@@ -32,6 +32,8 @@ if ! test -x /usr/sbin/openconnect;then
|
|||||||
exit 77
|
exit 77
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
OPENCONNECT=/usr/sbin/openconnect
|
||||||
|
|
||||||
fail() {
|
fail() {
|
||||||
PID=$1
|
PID=$1
|
||||||
shift;
|
shift;
|
||||||
|
|||||||
+3
-3
@@ -55,21 +55,21 @@ if test ! -z "$QUIT_ON_INIT";then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "testuser\n" >pass-full$TMP
|
printf "testuser\n" >pass-full$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong password succeeded!"
|
echo "Authentication with wrong password succeeded!"
|
||||||
stop
|
stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "test\n" >pass-full$TMP
|
printf "test\n" >pass-full$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong username succeeded!"
|
echo "Authentication with wrong username succeeded!"
|
||||||
stop
|
stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "test\n" >pass-full$TMP
|
printf "test\n" >pass-full$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-full$TMP &
|
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-full$TMP &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
rm -f pass-full$TMP
|
rm -f pass-full$TMP
|
||||||
|
|||||||
+3
-3
@@ -54,21 +54,21 @@ if test ! -z "$QUIT_ON_INIT";then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "testuser\n" >pass-pam.tmp
|
printf "testuser\n" >pass-pam.tmp
|
||||||
openconnect $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-pam.tmp
|
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-pam.tmp
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong password succeeded!"
|
echo "Authentication with wrong password succeeded!"
|
||||||
stop
|
stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "testuser123\n" >pass-pam.tmp
|
printf "testuser123\n" >pass-pam.tmp
|
||||||
openconnect $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-pam.tmp
|
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-pam.tmp
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong username succeeded!"
|
echo "Authentication with wrong username succeeded!"
|
||||||
stop
|
stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "testuser123\n" >pass-pam.tmp
|
printf "testuser123\n" >pass-pam.tmp
|
||||||
openconnect $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-pam.tmp &
|
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-pam.tmp &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
rm -f pass-pam.tmp
|
rm -f pass-pam.tmp
|
||||||
|
|||||||
+3
-3
@@ -57,14 +57,14 @@ if test ! -z "$QUIT_ON_INIT";then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "testuser\n" >pass-radius$TMP
|
printf "testuser\n" >pass-radius$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong password succeeded!"
|
echo "Authentication with wrong password succeeded!"
|
||||||
stop
|
stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "test\n" >pass-radius$TMP
|
printf "test\n" >pass-radius$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
||||||
if test $? = 0;then
|
if test $? = 0;then
|
||||||
echo "Authentication with wrong username succeeded!"
|
echo "Authentication with wrong username succeeded!"
|
||||||
stop
|
stop
|
||||||
@@ -72,7 +72,7 @@ fi
|
|||||||
|
|
||||||
echo "Trying with correct password"
|
echo "Trying with correct password"
|
||||||
printf "test\n" >pass-radius$TMP
|
printf "test\n" >pass-radius$TMP
|
||||||
openconnect $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-radius$TMP &
|
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-radius$TMP &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
rm -f pass-radius$TMP
|
rm -f pass-radius$TMP
|
||||||
|
|||||||
+13
-13
@@ -30,15 +30,15 @@ launch_server -d 1 -f -c ${srcdir}/test-ban.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting with wrong password 5 times... "
|
echo "Connecting with wrong password 5 times... "
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting with correct password... "
|
echo "Connecting with correct password... "
|
||||||
eval `echo "test" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -n "$COOKIE" ];then
|
if [ -n "$COOKIE" ];then
|
||||||
fail $PID "Obtained cookie although should have been banned"
|
fail $PID "Obtained cookie although should have been banned"
|
||||||
@@ -49,7 +49,7 @@ sleep 25
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "Connecting with correct password after ban time... "
|
echo "Connecting with correct password after ban time... "
|
||||||
eval `echo "test" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
fail $PID "Could not obtain cookie even though ban should be lifted"
|
fail $PID "Could not obtain cookie even though ban should be lifted"
|
||||||
@@ -58,16 +58,16 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Checking ban reset time... "
|
echo "Checking ban reset time... "
|
||||||
|
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
sleep 11
|
sleep 11
|
||||||
echo "notest" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "notest" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting with correct password after ban reset time... "
|
echo "Connecting with correct password after ban reset time... "
|
||||||
eval `echo "test" | openconnect --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT --passwd-on-stdin -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
fail $PID "Could not obtain cookie even though ban should be lifted"
|
fail $PID "Could not obtain cookie even though ban should be lifted"
|
||||||
|
|||||||
+4
-4
@@ -43,13 +43,13 @@ PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (without certificate)... "
|
echo -n "Connecting to obtain cookie (without certificate)... "
|
||||||
( openconnect -q localhost:$PORT --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
|
( $OPENCONNECT -q localhost:$PORT --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Connected without certificate!"
|
fail $PID "Connected without certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
( $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
@@ -68,13 +68,13 @@ kill -HUP $PID
|
|||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with revoked certificate)... "
|
echo -n "Connecting to obtain cookie (with revoked certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
|
( $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Connected with revoked certificate!"
|
fail $PID "Connected with revoked certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
#echo "Normal connection... "
|
#echo "Normal connection... "
|
||||||
#( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
#( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
||||||
# fail $PID "Could not connect to server"
|
# fail $PID "Could not connect to server"
|
||||||
|
|
||||||
rm -f crl.pem crl.tmpl
|
rm -f crl.pem crl.tmpl
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ launch_server -d 1 -f -c ${srcdir}/test-cookie-timeout.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
eval `echo "test" | openconnect -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
fail $PID "Could not obtain cookie"
|
fail $PID "Could not obtain cookie"
|
||||||
@@ -41,7 +41,7 @@ fi
|
|||||||
sleep 10
|
sleep 10
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting with cookie... "
|
echo "Connecting with cookie... "
|
||||||
echo "test" | openconnect -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
echo "test" | $OPENCONNECT -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ wait $CPID
|
|||||||
sleep 10
|
sleep 10
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting again with cookie... "
|
echo "Connecting again with cookie... "
|
||||||
echo "test" | openconnect -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
echo "test" | $OPENCONNECT -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ wait $CPID
|
|||||||
sleep 10
|
sleep 10
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting after forced kill with cookie... "
|
echo "Connecting after forced kill with cookie... "
|
||||||
echo "test" | openconnect -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
echo "test" | $OPENCONNECT -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ wait $CPID
|
|||||||
sleep 40
|
sleep 40
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting with cookie after expiration... "
|
echo "Connecting with cookie after expiration... "
|
||||||
echo "test" | openconnect -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
echo "test" | $OPENCONNECT -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ fi
|
|||||||
# test cookie verification after cookie verification failure. That is to verify whether
|
# test cookie verification after cookie verification failure. That is to verify whether
|
||||||
# the channel between main and sec-mod is in consistent state.
|
# the channel between main and sec-mod is in consistent state.
|
||||||
echo "Connecting (again) to obtain cookie... "
|
echo "Connecting (again) to obtain cookie... "
|
||||||
echo "test" | openconnect -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3
|
||||||
|
|
||||||
if test $? != 0;then
|
if test $? != 0;then
|
||||||
fail $PID "Could not obtain cookie"
|
fail $PID "Could not obtain cookie"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ launch_server -d 1 -f -c ${srcdir}/test-cookie-timeout-2.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
eval `echo "test" | openconnect -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
fail $PID "Could not obtain cookie"
|
fail $PID "Could not obtain cookie"
|
||||||
@@ -41,7 +41,7 @@ fi
|
|||||||
sleep 10
|
sleep 10
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting with cookie... "
|
echo "Connecting with cookie... "
|
||||||
echo "test" | openconnect -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid.$$ &
|
echo "test" | $OPENCONNECT -q -b localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid.$$ &
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ rm -f "${srcdir}/pid2.$$"
|
|||||||
sleep 30
|
sleep 30
|
||||||
echo ""
|
echo ""
|
||||||
echo "Connecting again with cookie (overriding first session)... "
|
echo "Connecting again with cookie (overriding first session)... "
|
||||||
echo "test" | openconnect -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid2.$$ &
|
echo "test" | $OPENCONNECT -b -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid2.$$ &
|
||||||
|
|
||||||
sleep 6
|
sleep 6
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ connect()
|
|||||||
opts=$1
|
opts=$1
|
||||||
pass=$2
|
pass=$2
|
||||||
COOKIE=''
|
COOKIE=''
|
||||||
eval `echo "$pass" | openconnect -q localhost:$PORT $opts --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --authenticate`
|
eval `echo "$pass" | $OPENCONNECT -q localhost:$PORT $opts --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --authenticate`
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $TMPFILE
|
rm -f $TMPFILE
|
||||||
echo "$pass" | openconnect -q localhost:$PORT $opts -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pidx >$TMPFILE 2>&1 &
|
echo "$pass" | $OPENCONNECT -q localhost:$PORT $opts -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pidx >$TMPFILE 2>&1 &
|
||||||
CPID=$!
|
CPID=$!
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|||||||
@@ -30,31 +30,31 @@ launch_server -d 1 -f -c test-group-cert.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (without certificate)... "
|
echo -n "Connecting to obtain cookie (without certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Connected without certificate!"
|
fail $PID "Connected without certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group4 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group4 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group4 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group4 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|||||||
@@ -30,19 +30,19 @@ launch_server -d 1 -f -c test-group-pass.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --authgroup group1 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authgroup group1 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --authgroup group2 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authgroup group2 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --authgroup group2 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authgroup group2 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie with wrong groupname... "
|
echo "Connecting to obtain cookie with wrong groupname... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --authgroup group4 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authgroup group4 --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Received cookie when we shouldn't"
|
fail $PID "Received cookie when we shouldn't"
|
||||||
|
|
||||||
kill $PID
|
kill $PID
|
||||||
|
|||||||
+2
-2
@@ -32,13 +32,13 @@ launch_server -d 1 -f -c ${srcdir}/test-iroute.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
( $OPENCONNECT -q localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Re-connecting to force script run... "
|
echo -n "Re-connecting to force script run... "
|
||||||
openconnect -q localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s ./bin/true </dev/null >/dev/null 2>&1 &
|
$OPENCONNECT -q localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s ./bin/true </dev/null &
|
||||||
kpid=$!
|
kpid=$!
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ launch_server -d 1 -f -c ${srcdir}/test-multi-cookie.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
eval `echo "test" | openconnect -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
eval `echo "test" | $OPENCONNECT -q localhost:$PORT -u test --authenticate --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3`
|
||||||
|
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
fail $PID "Could not obtain cookie"
|
fail $PID "Could not obtain cookie"
|
||||||
@@ -40,15 +40,15 @@ fi
|
|||||||
#echo "Cookie: $COOKIE"
|
#echo "Cookie: $COOKIE"
|
||||||
|
|
||||||
echo "Connecting with cookie... "
|
echo "Connecting with cookie... "
|
||||||
echo "test" | openconnect -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
echo "test" | $OPENCONNECT -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid1.$$ &
|
||||||
CPID=$!
|
CPID=$!
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
echo "Connecting again with same cookie... "
|
echo "Connecting again with same cookie... "
|
||||||
#( echo "test" | openconnect -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
#( echo "test" | $OPENCONNECT -q localhost:$PORT -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
# fail $PID "Could not connect to server"
|
# fail $PID "Could not connect to server"
|
||||||
echo "test" | openconnect -q localhost:$PORT -b -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid2.$$ &
|
echo "test" | $OPENCONNECT -q localhost:$PORT -b -u test -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pid2.$$ &
|
||||||
C2PID=$!
|
C2PID=$!
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|||||||
+6
-6
@@ -30,29 +30,29 @@ launch_server -d 1 -f -c test1.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie with wrong password... "
|
echo "Connecting to obtain cookie with wrong password... "
|
||||||
( echo "tost" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "tost" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Received cookie when we shouldn't"
|
fail $PID "Received cookie when we shouldn't"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie with wrong username... "
|
echo "Connecting to obtain cookie with wrong username... "
|
||||||
( echo "tost" | openconnect -q localhost:$PORT -u tost --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "tost" | $OPENCONNECT -q localhost:$PORT -u tost --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Received cookie when we shouldn't"
|
fail $PID "Received cookie when we shouldn't"
|
||||||
|
|
||||||
#test special characters
|
#test special characters
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "!@#$%^&*()<>" | openconnect -q localhost:$PORT -u "sp@c/al" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "!@#$%^&*()<>" | $OPENCONNECT -q localhost:$PORT -u "sp@c/al" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Connecting to obtain cookie with empty password... "
|
echo "Connecting to obtain cookie with empty password... "
|
||||||
( echo "" | openconnect -q localhost:$PORT -u "empty" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "" | $OPENCONNECT -q localhost:$PORT -u "empty" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
#echo "Normal connection... "
|
#echo "Normal connection... "
|
||||||
#( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
#( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
||||||
# fail $PID "Could not connect to server"
|
# fail $PID "Could not connect to server"
|
||||||
|
|
||||||
kill $PID
|
kill $PID
|
||||||
|
|||||||
@@ -30,26 +30,26 @@ launch_server -d 1 -f -c test-user-cert.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (without certificate)... "
|
echo -n "Connecting to obtain cookie (without certificate)... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Connected without certificate!"
|
fail $PID "Connected without certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with incorrect certificate)... "
|
echo -n "Connecting to obtain cookie (with incorrect certificate)... "
|
||||||
( echo "test" | openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert-wrong.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert-wrong.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Should not have connected with wrong certificate!"
|
fail $PID "Should not have connected with wrong certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
|
|
||||||
#echo "Normal connection... "
|
#echo "Normal connection... "
|
||||||
#( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
#( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
||||||
# fail $PID "Could not connect to server"
|
# fail $PID "Could not connect to server"
|
||||||
|
|
||||||
kill $PID
|
kill $PID
|
||||||
|
|||||||
@@ -30,37 +30,37 @@ launch_server -d 1 -f -c test-user-group-cert.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (without certificate)... "
|
echo -n "Connecting to obtain cookie (without certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Connected without certificate!"
|
fail $PID "Connected without certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - DEFAULT (with certificate)... "
|
echo -n "Connecting to obtain cookie - DEFAULT (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup DEFAULT -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup DEFAULT -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "test" | $OPENCONNECT --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group4 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group4 (with certificate)... "
|
||||||
( echo "test" | openconnect --authgroup group4 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "test" | $OPENCONNECT --authgroup group4 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Got cookie when it shouldn't!"
|
fail $PID "Got cookie when it shouldn't!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|||||||
@@ -30,25 +30,25 @@ launch_server -d 1 -f -c test-user-group-cert-no-pass.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (without certificate)... "
|
echo -n "Connecting to obtain cookie (without certificate)... "
|
||||||
openconnect --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 &&
|
$OPENCONNECT --authgroup group1 -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 &&
|
||||||
fail $PID "Connected without certificate!"
|
fail $PID "Connected without certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group1 (with certificate)... "
|
||||||
openconnect --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
$OPENCONNECT --authgroup group1 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
echo -n "Connecting to obtain cookie - group2 (with certificate)... "
|
||||||
openconnect --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
$OPENCONNECT --authgroup group2 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
echo -n "Connecting to obtain cookie - group3 (hidden) (with certificate)... "
|
||||||
openconnect --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
$OPENCONNECT --authgroup group3 -q localhost:$PORT --sslkey ./user-group-key.pem -c ./user-group-cert.pem -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ connect()
|
|||||||
opts=$1
|
opts=$1
|
||||||
pass=$2
|
pass=$2
|
||||||
COOKIE=''
|
COOKIE=''
|
||||||
eval `echo "$pass" | openconnect -q localhost:$PORT $opts --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --authenticate`
|
eval `echo "$pass" | $OPENCONNECT -q localhost:$PORT $opts --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --authenticate`
|
||||||
if [ -z "$COOKIE" ];then
|
if [ -z "$COOKIE" ];then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $TMPFILE
|
rm -f $TMPFILE
|
||||||
echo "$pass" | openconnect -q localhost:$PORT $opts -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pidx >$TMPFILE 2>&1 &
|
echo "$pass" | $OPENCONNECT -q localhost:$PORT $opts -C "$COOKIE" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true --verbose --pid-file ${srcdir}/pidx >$TMPFILE 2>&1 &
|
||||||
CPID=$!
|
CPID=$!
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
@@ -85,7 +85,7 @@ fi
|
|||||||
echo ok
|
echo ok
|
||||||
|
|
||||||
#echo "Normal connection... "
|
#echo "Normal connection... "
|
||||||
#( echo "test" | openconnect -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
#( echo "test" | $OPENCONNECT -q localhost:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --script=/bin/true ) ||
|
||||||
# fail $PID "Could not connect to server"
|
# fail $PID "Could not connect to server"
|
||||||
|
|
||||||
kill $PID
|
kill $PID
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ launch_server -d 1 -f -c test-pass-script.config & PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo "Connecting to obtain cookie with wrong username... "
|
echo "Connecting to obtain cookie with wrong username... "
|
||||||
( echo "tost" | openconnect -q localhost:$PORT -u tost --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
( echo "tost" | $OPENCONNECT -q localhost:$PORT -u tost --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) &&
|
||||||
fail $PID "Received cookie when we shouldn't"
|
fail $PID "Received cookie when we shouldn't"
|
||||||
|
|
||||||
rm -f ${builddir}/connect.ok
|
rm -f ${builddir}/connect.ok
|
||||||
@@ -42,11 +42,11 @@ rm -f ${builddir}/disconnect.ok
|
|||||||
#test special characters
|
#test special characters
|
||||||
|
|
||||||
echo "Connecting to obtain cookie... "
|
echo "Connecting to obtain cookie... "
|
||||||
( echo "!@#$%^&*()<>" | openconnect -q localhost:$PORT -u sp@c/al --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
( echo "!@#$%^&*()<>" | $OPENCONNECT -q localhost:$PORT -u sp@c/al --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not receive cookie from server"
|
fail $PID "Could not receive cookie from server"
|
||||||
|
|
||||||
echo "Re-connecting to force script run... "
|
echo "Re-connecting to force script run... "
|
||||||
echo "!@#$%^&*()<>" | openconnect -q localhost:$PORT -u sp@c/al --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s ./bin/true >/dev/null 2>&1 &
|
echo "!@#$%^&*()<>" | $OPENCONNECT -q localhost:$PORT -u sp@c/al --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s ./bin/true >/dev/null 2>&1 &
|
||||||
kpid=$!
|
kpid=$!
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
+3
-3
@@ -33,7 +33,7 @@ PID=$!
|
|||||||
wait_server $PID
|
wait_server $PID
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
( $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
@@ -43,7 +43,7 @@ kill -HUP $PID
|
|||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
( $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
@@ -55,7 +55,7 @@ kill -HUP $PID
|
|||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo -n "Connecting to obtain cookie (with certificate)... "
|
echo -n "Connecting to obtain cookie (with certificate)... "
|
||||||
( openconnect -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
( $OPENCONNECT -q localhost:$PORT --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
|
||||||
fail $PID "Could not connect with certificate!"
|
fail $PID "Could not connect with certificate!"
|
||||||
|
|
||||||
echo ok
|
echo ok
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ run_client() {
|
|||||||
PASS=$1;
|
PASS=$1;
|
||||||
shift;
|
shift;
|
||||||
|
|
||||||
( echo $PASS | openconnect -q $HOST -u $USER --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s /bin/true >/dev/null 2>&1 ) ||
|
( echo $PASS | $OPENCONNECT -q $HOST -u $USER --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s /bin/true >/dev/null 2>&1 ) ||
|
||||||
echo "$USER: Could not connect to server"
|
echo "$USER: Could not connect to server"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ if test ! -z "$QUIT_ON_INIT";then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "test\ntest\n" >pass$TMP
|
printf "test\ntest\n" >pass$TMP
|
||||||
openconnect $IP:6551 -u test --passwd-on-stdin --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass$TMP &
|
$OPENCONNECT $IP:6551 -u test --passwd-on-stdin --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass$TMP &
|
||||||
PID=$!
|
PID=$!
|
||||||
|
|
||||||
rm -f pass$TMP
|
rm -f pass$TMP
|
||||||
|
|||||||
Reference in New Issue
Block a user