diff options
-rw-r--r-- | regress/usr.bin/ssh/Makefile | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/agent.sh | 28 | ||||
-rw-r--r-- | regress/usr.bin/ssh/broken-pipe.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/connect.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/exit-status.sh | 6 | ||||
-rw-r--r-- | regress/usr.bin/ssh/forwarding.sh | 6 | ||||
-rw-r--r-- | regress/usr.bin/ssh/keyscan.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/proto-mismatch.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/proto-version.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/proxy-connect.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/ssh-com.sh | 13 | ||||
-rw-r--r-- | regress/usr.bin/ssh/test-exec.sh | 45 | ||||
-rw-r--r-- | regress/usr.bin/ssh/try-ciphers.sh | 6 | ||||
-rw-r--r-- | regress/usr.bin/ssh/yes-head.sh | 4 |
14 files changed, 85 insertions, 51 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index c6726c34dd5..bebfd43d5db 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2002/02/22 12:31:35 markus Exp $ +# $OpenBSD: Makefile,v 1.6 2002/03/15 13:08:56 markus Exp $ REGRESSTARGETS= t1 t2 t3 t4 t5 t6 t7 @@ -23,6 +23,8 @@ CLEANFILES+= authorized_keys_${USER} known_hosts pidfile \ rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ ls.copy +#LTESTS+= ssh-com + t1: ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv diff --git a/regress/usr.bin/ssh/agent.sh b/regress/usr.bin/ssh/agent.sh index 64623c0064d..7e9b4cb1870 100644 --- a/regress/usr.bin/ssh/agent.sh +++ b/regress/usr.bin/ssh/agent.sh @@ -1,20 +1,20 @@ -# $OpenBSD: agent.sh,v 1.5 2002/02/17 22:22:45 markus Exp $ +# $OpenBSD: agent.sh,v 1.6 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="simple agent test" -SSH_AUTH_SOCK=/nonexistant ssh-add -l > /dev/null 2>&1 +SSH_AUTH_SOCK=/nonexistant ${SSHADD} -l > /dev/null 2>&1 if [ $? -ne 2 ]; then fail "ssh-add -l did not fail with exit code 2" fi trace "start agent" -eval `ssh-agent -s` > /dev/null +eval `${SSHAGENT} -s` > /dev/null r=$? if [ $r -ne 0 ]; then fail "could not start ssh-agent: exit code $r" else - ssh-add -l > /dev/null 2>&1 + ${SSHADD} -l > /dev/null 2>&1 if [ $? -ne 1 ]; then fail "ssh-add -l did not fail with exit code 1" fi @@ -23,29 +23,29 @@ else for t in rsa rsa1; do # generate user key for agent rm -f $OBJ/$t-agent - ssh-keygen -q -N '' -t $t -f $OBJ/$t-agent ||\ + ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\ fail "ssh-keygen for $t-agent failed" # add to authorized keys cat $OBJ/$t-agent.pub >> $OBJ/authorized_keys_$USER # add privat key to agent - ssh-add $OBJ/$t-agent > /dev/null 2>&1 + ${SSHADD} $OBJ/$t-agent > /dev/null 2>&1 if [ $? -ne 0 ]; then fail "ssh-add did succeed exit code 0" fi done - ssh-add -l > /dev/null 2>&1 + ${SSHADD} -l > /dev/null 2>&1 if [ $? -ne 0 ]; then fail "ssh-add -l failed: exit code $?" fi # the same for full pubkey output - ssh-add -L > /dev/null 2>&1 + ${SSHADD} -L > /dev/null 2>&1 if [ $? -ne 0 ]; then fail "ssh-add -L failed: exit code $?" fi trace "simple connect via agent" for p in 1 2; do - ssh -$p -F $OBJ/ssh_proxy somehost exit 5$p + ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p if [ $? -ne 5$p ]; then fail "ssh connect with protocol $p failed (exit code $?)" fi @@ -53,23 +53,23 @@ else trace "agent forwarding" for p in 1 2; do - ssh -A -$p -F $OBJ/ssh_proxy somehost ssh-add -l > /dev/null 2>&1 + ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 if [ $? -ne 0 ]; then fail "ssh-add -l via agent fwd proto $p failed (exit code $?)" fi - ssh -A -$p -F $OBJ/ssh_proxy somehost \ - "ssh -$p -F $OBJ/ssh_proxy somehost exit 5$p" + ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ + "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" if [ $? -ne 5$p ]; then fail "agent fwd proto $p failed (exit code $?)" fi done trace "delete all agent keys" - ssh-add -D > /dev/null 2>&1 + ${SSHADD} -D > /dev/null 2>&1 if [ $? -ne 0 ]; then fail "ssh-add -D failed: exit code $?" fi trace "kill agent" - ssh-agent -k > /dev/null + ${SSHAGENT} -k > /dev/null fi diff --git a/regress/usr.bin/ssh/broken-pipe.sh b/regress/usr.bin/ssh/broken-pipe.sh index 5adc5f44eed..c08c849a758 100644 --- a/regress/usr.bin/ssh/broken-pipe.sh +++ b/regress/usr.bin/ssh/broken-pipe.sh @@ -1,4 +1,4 @@ -# $OpenBSD: broken-pipe.sh,v 1.3 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: broken-pipe.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="broken pipe test" @@ -6,7 +6,7 @@ tid="broken pipe test" for p in 1 2; do trace "protocol $p" for i in 1 2 3 4; do - ssh -$p -F $OBJ/ssh_config_config nexthost echo $i 2> /dev/null | true + ${SSH} -$p -F $OBJ/ssh_config_config nexthost echo $i 2> /dev/null | true r=$? if [ $r -ne 0 ]; then fail "broken pipe returns $r for protocol $p" diff --git a/regress/usr.bin/ssh/connect.sh b/regress/usr.bin/ssh/connect.sh index 4fe77fa47a2..2186fa6e7eb 100644 --- a/regress/usr.bin/ssh/connect.sh +++ b/regress/usr.bin/ssh/connect.sh @@ -1,4 +1,4 @@ -# $OpenBSD: connect.sh,v 1.3 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="simple connect" @@ -6,7 +6,7 @@ tid="simple connect" start_sshd for p in 1 2; do - ssh -o "Protocol=$p" -F $OBJ/ssh_config somehost true + ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true if [ $? -ne 0 ]; then fail "ssh connect with protocol $p failed" fi diff --git a/regress/usr.bin/ssh/exit-status.sh b/regress/usr.bin/ssh/exit-status.sh index 64e17b0214a..56b78a622b7 100644 --- a/regress/usr.bin/ssh/exit-status.sh +++ b/regress/usr.bin/ssh/exit-status.sh @@ -1,4 +1,4 @@ -# $OpenBSD: exit-status.sh,v 1.5 2002/02/18 12:52:26 markus Exp $ +# $OpenBSD: exit-status.sh,v 1.6 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="remote exit status" @@ -7,14 +7,14 @@ for p in 1 2; do for s in 0 1 4 5 44; do trace "proto $p status $s" verbose "test $tid: proto $p status $s" - ssh -$p -F $OBJ/ssh_proxy otherhost exit $s + ${SSH} -$p -F $OBJ/ssh_proxy otherhost exit $s r=$? if [ $r -ne $s ]; then fail "exit code mismatch for protocol $p: $r != $s" fi # same with early close of stdout/err - ssh -$p -F $OBJ/ssh_proxy -n otherhost \ + ${SSH} -$p -F $OBJ/ssh_proxy -n otherhost \ exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\' r=$? if [ $r -ne $s ]; then diff --git a/regress/usr.bin/ssh/forwarding.sh b/regress/usr.bin/ssh/forwarding.sh index 8f770301c69..7b281c0133d 100644 --- a/regress/usr.bin/ssh/forwarding.sh +++ b/regress/usr.bin/ssh/forwarding.sh @@ -1,4 +1,4 @@ -# $OpenBSD: forwarding.sh,v 1.3 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: forwarding.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="local and remote forwarding" @@ -21,10 +21,10 @@ done for p in 1 2; do q=`expr 3 - $p` trace "start forwarding, fork to background" - ssh -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10 + ${SSH} -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10 trace "transfer over forwarded channels and check result" - ssh -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ + ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ somehost cat /bin/ls > $OBJ/ls.copy test -f $OBJ/ls.copy || fail "failed copy /bin/ls" cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" diff --git a/regress/usr.bin/ssh/keyscan.sh b/regress/usr.bin/ssh/keyscan.sh index 07f46cd6dfd..33f14f0fcc9 100644 --- a/regress/usr.bin/ssh/keyscan.sh +++ b/regress/usr.bin/ssh/keyscan.sh @@ -1,4 +1,4 @@ -# $OpenBSD: keyscan.sh,v 1.2 2002/02/22 12:38:27 markus Exp $ +# $OpenBSD: keyscan.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="keyscan" @@ -10,7 +10,7 @@ start_sshd for t in rsa1 rsa dsa; do trace "keyscan type $t" - ssh-keyscan -t $t -p $PORT 127.0.0.1 127.0.0.1 127.0.0.1 \ + ${SSHKEYSCAN} -t $t -p $PORT 127.0.0.1 127.0.0.1 127.0.0.1 \ > /dev/null 2>&1 r=$? if [ $r -ne 0 ]; then diff --git a/regress/usr.bin/ssh/proto-mismatch.sh b/regress/usr.bin/ssh/proto-mismatch.sh index 3ea1d92fd5e..fb521f214fd 100644 --- a/regress/usr.bin/ssh/proto-mismatch.sh +++ b/regress/usr.bin/ssh/proto-mismatch.sh @@ -1,4 +1,4 @@ -# $OpenBSD: proto-mismatch.sh,v 1.2 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: proto-mismatch.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="protocol version mismatch" @@ -7,7 +7,7 @@ mismatch () { server=$1 client=$2 - banner=`echo ${client} | sshd -o "Protocol=${server}" -i -f ${OBJ}/sshd_proxy` + banner=`echo ${client} | ${SSHD} -o "Protocol=${server}" -i -f ${OBJ}/sshd_proxy` r=$? trace "sshd prints ${banner}" if [ $r -ne 255 ]; then diff --git a/regress/usr.bin/ssh/proto-version.sh b/regress/usr.bin/ssh/proto-version.sh index ad178a499eb..7dc616f5fed 100644 --- a/regress/usr.bin/ssh/proto-version.sh +++ b/regress/usr.bin/ssh/proto-version.sh @@ -1,4 +1,4 @@ -# $OpenBSD: proto-version.sh,v 1.2 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: proto-version.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="sshd version with different protocol combinations" @@ -8,7 +8,7 @@ check_version () { version=$1 expect=$2 - banner=`echo -n | sshd -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy` + banner=`echo -n | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy` case ${banner} in SSH-1.99-*) proto=199 diff --git a/regress/usr.bin/ssh/proxy-connect.sh b/regress/usr.bin/ssh/proxy-connect.sh index 8949ffd5a4d..bf1940fcc0e 100644 --- a/regress/usr.bin/ssh/proxy-connect.sh +++ b/regress/usr.bin/ssh/proxy-connect.sh @@ -1,10 +1,10 @@ -# $OpenBSD: proxy-connect.sh,v 1.3 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: proxy-connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="proxy connect" for p in 1 2; do - ssh -$p -F $OBJ/ssh_proxy 999.999.999.999 true + ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true if [ $? -ne 0 ]; then fail "ssh proxyconnect protocol $p failed" fi diff --git a/regress/usr.bin/ssh/ssh-com.sh b/regress/usr.bin/ssh/ssh-com.sh index d8209671194..6a199fa6583 100644 --- a/regress/usr.bin/ssh/ssh-com.sh +++ b/regress/usr.bin/ssh/ssh-com.sh @@ -1,4 +1,4 @@ -# $OpenBSD: ssh-com.sh,v 1.2 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: ssh-com.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="connect to ssh.com server" @@ -50,13 +50,13 @@ sed "s/HostKeyAlias.*/HostKeyAlias ssh2-localhost-with-alias/" \ # we need a DSA key for rm -f ${OBJ}/dsa ${OBJ}/dsa.pub -ssh-keygen -q -N '' -t dsa -f ${OBJ}/dsa +${SSHKEYGEN} -q -N '' -t dsa -f ${OBJ}/dsa # setup userdir, try rsa first mkdir -p ${OBJ}/${USER} cp /dev/null ${OBJ}/${USER}/authorization for t in rsa dsa; do - ssh-keygen -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com + ${SSHKEYGEN} -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com echo Key $t.com >> ${OBJ}/${USER}/authorization echo IdentityFile ${OBJ}/$t >> ${OBJ}/ssh_config_com done @@ -64,7 +64,7 @@ done # convert and append DSA hostkey ( echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 ' - ssh-keygen -if ${SRC}/dsa_ssh2.pub + ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub ) >> $OBJ/known_hosts # go for it @@ -75,7 +75,7 @@ for v in ${VERSIONS}; do fi trace "sshd2 ${v}" PROXY="proxycommand ${sshd2} -qif ${OBJ}/sshd2_config 2> /dev/null" - ssh -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 + ${SSH} -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 if [ $? -ne 0 ]; then fail "ssh connect to sshd2 ${v} failed" fi @@ -96,7 +96,8 @@ for v in ${VERSIONS}; do for m in $macs; do for c in $ciphers; do trace "sshd2 ${v} cipher $c mac $m" - ssh -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 + verbose "test ${tid}: sshd2 ${v} cipher $c mac $m" + ${SSH} -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 if [ $? -ne 0 ]; then fail "ssh connect to sshd2 ${v} with $c/$m failed" fi diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index 57e8caba786..785082b7628 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.9 2002/02/18 14:30:12 markus Exp $ +# $OpenBSD: test-exec.sh,v 1.10 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. PORT=4242 @@ -32,6 +32,37 @@ else fi unset SSH_AUTH_SOCK +# defaults +SSH=ssh +SSHD=sshd +SSHAGENT=ssh-agent +SSHADD=ssh-add +SSHKEYGEN=ssh-keygen +SSHKEYSCAN=ssh-keyscan + +if [ "x$TEST_SSH_SSH" != "x" ]; then + SSH=${TEST_SSH_SSH} +fi +if [ "x$TEST_SSH_SSHD" != "x" ]; then + SSHD=${TEST_SSH_SSHD} +fi +if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then + SSHAGENT=${TEST_SSH_SSHAGENT} +fi +if [ "x$TEST_SSH_SSHADD" != "x" ]; then + SSHADD=${TEST_SSH_SSHADD} +fi +if [ "x$TEST_SSH_SSHKEYGEN" != "x" ]; then + SSHKEYGEN=${TEST_SSH_SSHKEYGEN} +fi +if [ "x$TEST_SSH_SSHKEYSCAN" != "x" ]; then + SSHKEYSCAN=${TEST_SSH_SSHKEYSCAN} +fi + +# these should be used in tests +export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN +#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN + # helper cleanup () { @@ -112,7 +143,6 @@ Host * PubkeyAuthentication yes ChallengeResponseAuthentication no HostbasedAuthentication no - KerberosAuthentication no PasswordAuthentication no RhostsAuthentication no RhostsRSAAuthentication no @@ -124,7 +154,8 @@ trace "generate keys" for t in rsa rsa1; do # generate user key rm -f $OBJ/$t - ssh-keygen -q -N '' -t $t -f $OBJ/$t || fail "ssh-keygen for $t failed" + ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\ + fail "ssh-keygen for $t failed" # known hosts file for client ( @@ -148,17 +179,17 @@ chmod 644 $OBJ/authorized_keys_$USER # create a proxy version of the client config ( cat $OBJ/ssh_config - echo proxycommand sshd -i -f $OBJ/sshd_proxy + echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy ) > $OBJ/ssh_proxy # check proxy config -sshd -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken" +${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken" start_sshd () { # start sshd - $SUDO sshd -f $OBJ/sshd_config -t || fatal "sshd_config broken" - $SUDO sshd -f $OBJ/sshd_config + $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" + $SUDO ${SSHD} -f $OBJ/sshd_config trace "wait for sshd" i=0; diff --git a/regress/usr.bin/ssh/try-ciphers.sh b/regress/usr.bin/ssh/try-ciphers.sh index 527849f6489..d8aa709508a 100644 --- a/regress/usr.bin/ssh/try-ciphers.sh +++ b/regress/usr.bin/ssh/try-ciphers.sh @@ -1,4 +1,4 @@ -# $OpenBSD: try-ciphers.sh,v 1.5 2002/02/18 12:52:26 markus Exp $ +# $OpenBSD: try-ciphers.sh,v 1.6 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="try ciphers" @@ -10,7 +10,7 @@ for c in $ciphers; do for m in $macs; do trace "proto 2 cipher $c mac $m" verbose "test $tid: proto 2 cipher $c mac $m" - ssh -F $OBJ/ssh_proxy -2 -m $m -c $c somehost true + ${SSH} -F $OBJ/ssh_proxy -2 -m $m -c $c somehost true if [ $? -ne 0 ]; then fail "ssh -2 failed with mac $m cipher $c" fi @@ -21,7 +21,7 @@ ciphers="3des blowfish" for c in $ciphers; do trace "proto 1 cipher $c" verbose "test $tid: proto 1 cipher $c" - ssh -F $OBJ/ssh_proxy -1 -c $c somehost true + ${SSH} -F $OBJ/ssh_proxy -1 -c $c somehost true if [ $? -ne 0 ]; then fail "ssh -1 failed with cipher $c" fi diff --git a/regress/usr.bin/ssh/yes-head.sh b/regress/usr.bin/ssh/yes-head.sh index e8d40084036..f213f6863ca 100644 --- a/regress/usr.bin/ssh/yes-head.sh +++ b/regress/usr.bin/ssh/yes-head.sh @@ -1,10 +1,10 @@ -# $OpenBSD: yes-head.sh,v 1.3 2002/02/16 01:09:47 markus Exp $ +# $OpenBSD: yes-head.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # Placed in the Public Domain. tid="yes pipe head" for p in 1 2; do - lines=`ssh -$p -F $OBJ/ssh_proxy thishost 'yes | head -2000' | (sleep 3 ; wc -l)` + lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'yes | head -2000' | (sleep 3 ; wc -l)` if [ $? -ne 0 ]; then fail "yes|head test failed" lines = 0; |