upstream commit

make it possible to run tests w/o ssh1 support; ok djm@
This commit is contained in:
markus@openbsd.org 2015-03-03 22:35:19 +00:00 committed by Damien Miller
parent d48a22601b
commit dad2b1892b
27 changed files with 139 additions and 90 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: agent-timeout.sh,v 1.2 2013/05/17 01:16:09 dtucker Exp $ # $OpenBSD: agent-timeout.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="agent timeout test" tid="agent timeout test"
@ -12,7 +12,7 @@ if [ $r -ne 0 ]; then
fail "could not start ssh-agent: exit code $r" fail "could not start ssh-agent: exit code $r"
else else
trace "add keys with timeout" trace "add keys with timeout"
for t in rsa rsa1; do for t in ${SSH_KEYTYPES}; do
${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1 ${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh-add did succeed exit code 0" fail "ssh-add did succeed exit code 0"

View File

@ -1,4 +1,4 @@
# $OpenBSD: agent.sh,v 1.10 2014/02/27 21:21:25 djm Exp $ # $OpenBSD: agent.sh,v 1.11 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="simple agent test" tid="simple agent test"
@ -20,7 +20,7 @@ else
fi fi
trace "overwrite authorized keys" trace "overwrite authorized keys"
printf '' > $OBJ/authorized_keys_$USER printf '' > $OBJ/authorized_keys_$USER
for t in ed25519 rsa rsa1; do for t in ${SSH_KEYTYPES}; do
# generate user key for agent # generate user key for agent
rm -f $OBJ/$t-agent rm -f $OBJ/$t-agent
${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\ ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\
@ -46,7 +46,7 @@ else
fi fi
trace "simple connect via agent" trace "simple connect via agent"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p
r=$? r=$?
if [ $r -ne 5$p ]; then if [ $r -ne 5$p ]; then
@ -55,7 +55,7 @@ else
done done
trace "agent forwarding" trace "agent forwarding"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1
r=$? r=$?
if [ $r -ne 0 ]; then if [ $r -ne 0 ]; then

View File

@ -1,9 +1,9 @@
# $OpenBSD: broken-pipe.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: broken-pipe.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="broken pipe test" tid="broken pipe test"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "protocol $p" trace "protocol $p"
for i in 1 2 3 4; do 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

View File

@ -1,4 +1,4 @@
# $OpenBSD: cfgmatch.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $ # $OpenBSD: cfgmatch.sh,v 1.9 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="sshd_config match" tid="sshd_config match"
@ -56,7 +56,7 @@ start_sshd
#set -x #set -x
# Test Match + PermitOpen in sshd_config. This should be permitted # Test Match + PermitOpen in sshd_config. This should be permitted
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "match permitopen localhost proto $p" trace "match permitopen localhost proto $p"
start_client -F $OBJ/ssh_config start_client -F $OBJ/ssh_config
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
@ -65,7 +65,7 @@ for p in 1 2; do
done done
# Same but from different source. This should not be permitted # Same but from different source. This should not be permitted
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "match permitopen proxy proto $p" trace "match permitopen proxy proto $p"
start_client -F $OBJ/ssh_proxy start_client -F $OBJ/ssh_proxy
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@ -74,11 +74,12 @@ for p in 1 2; do
done done
# Retry previous with key option, should also be denied. # Retry previous with key option, should also be denied.
printf 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER cp /dev/null $OBJ/authorized_keys_$USER
cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER for t in ${SSH_KEYTYPES}; do
printf 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER printf 'permitopen="127.0.0.1:'$PORT'" ' >> $OBJ/authorized_keys_$USER
cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
for p in 1 2; do done
for p in ${SSH_PROTOCOLS}; do
trace "match permitopen proxy w/key opts proto $p" trace "match permitopen proxy w/key opts proto $p"
start_client -F $OBJ/ssh_proxy start_client -F $OBJ/ssh_proxy
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@ -88,7 +89,7 @@ done
# Test both sshd_config and key options permitting the same dst/port pair. # Test both sshd_config and key options permitting the same dst/port pair.
# Should be permitted. # Should be permitted.
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "match permitopen localhost proto $p" trace "match permitopen localhost proto $p"
start_client -F $OBJ/ssh_config start_client -F $OBJ/ssh_config
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
@ -102,7 +103,7 @@ echo "Match User $USER" >>$OBJ/sshd_proxy
echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy
# Test that a Match overrides a PermitOpen in the global section # Test that a Match overrides a PermitOpen in the global section
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "match permitopen proxy w/key opts proto $p" trace "match permitopen proxy w/key opts proto $p"
start_client -F $OBJ/ssh_proxy start_client -F $OBJ/ssh_proxy
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
@ -117,7 +118,7 @@ echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy
# Test that a rule that doesn't match doesn't override, plus test a # Test that a rule that doesn't match doesn't override, plus test a
# PermitOpen entry that's not at the start of the list # PermitOpen entry that's not at the start of the list
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "nomatch permitopen proxy w/key opts proto $p" trace "nomatch permitopen proxy w/key opts proto $p"
start_client -F $OBJ/ssh_proxy start_client -F $OBJ/ssh_proxy
${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \ ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \

View File

@ -1,4 +1,4 @@
# $OpenBSD: cipher-speed.sh,v 1.11 2013/11/21 03:18:51 djm Exp $ # $OpenBSD: cipher-speed.sh,v 1.12 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="cipher speed" tid="cipher speed"
@ -31,7 +31,11 @@ for c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do
n=`expr $n + 1` n=`expr $n + 1`
done; done done; done
ciphers="3des blowfish" if ssh_version 1; then
ciphers="3des blowfish"
else
ciphers=""
fi
for c in $ciphers; do for c in $ciphers; do
trace "proto 1 cipher $c" trace "proto 1 cipher $c"
for x in $tries; do for x in $tries; do

View File

@ -1,4 +1,4 @@
# $OpenBSD: connect-privsep.sh,v 1.5 2014/05/04 10:40:59 logan Exp $ # $OpenBSD: connect-privsep.sh,v 1.6 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="proxy connect with privsep" tid="proxy connect with privsep"
@ -6,7 +6,7 @@ tid="proxy connect with privsep"
cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; 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 if [ $? -ne 0 ]; then
fail "ssh privsep+proxyconnect protocol $p failed" fail "ssh privsep+proxyconnect protocol $p failed"
@ -16,7 +16,7 @@ done
cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; 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 if [ $? -ne 0 ]; then
# XXX replace this with fail once sandbox has stabilised # XXX replace this with fail once sandbox has stabilised
@ -27,7 +27,7 @@ done
# Because sandbox is sensitive to changes in libc, especially malloc, retest # Because sandbox is sensitive to changes in libc, especially malloc, retest
# with every malloc.conf option (and none). # with every malloc.conf option (and none).
for m in '' A F G H J P R S X '<' '>'; do for m in '' A F G H J P R S X '<' '>'; do
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
env MALLOC_OPTIONS="$m" ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true env MALLOC_OPTIONS="$m" ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh privsep/sandbox+proxyconnect protocol $p mopt '$m' failed" fail "ssh privsep/sandbox+proxyconnect protocol $p mopt '$m' failed"

View File

@ -1,11 +1,11 @@
# $OpenBSD: connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: connect.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="simple connect" tid="simple connect"
start_sshd start_sshd
for p in 1 2; do for p in ${SSH_PROTOCOLS}; 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 if [ $? -ne 0 ]; then
fail "ssh connect with protocol $p failed" fail "ssh connect with protocol $p failed"

View File

@ -1,4 +1,4 @@
# $OpenBSD: dynamic-forward.sh,v 1.10 2013/05/17 04:29:14 dtucker Exp $ # $OpenBSD: dynamic-forward.sh,v 1.11 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="dynamic forwarding" tid="dynamic forwarding"
@ -17,7 +17,7 @@ trace "will use ProxyCommand $proxycmd"
start_sshd start_sshd
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
n=0 n=0
error="1" error="1"
trace "start dynamic forwarding, fork to background" trace "start dynamic forwarding, fork to background"

View File

@ -1,9 +1,9 @@
# $OpenBSD: exit-status.sh,v 1.6 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: exit-status.sh,v 1.7 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="remote exit status" tid="remote exit status"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
for s in 0 1 4 5 44; do for s in 0 1 4 5 44; do
trace "proto $p status $s" trace "proto $p status $s"
verbose "test $tid: proto $p status $s" verbose "test $tid: proto $p status $s"

View File

@ -1,30 +1,32 @@
# $OpenBSD: forcecommand.sh,v 1.2 2013/05/17 00:37:40 dtucker Exp $ # $OpenBSD: forcecommand.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="forced command" tid="forced command"
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
printf 'command="true" ' >$OBJ/authorized_keys_$USER cp /dev/null $OBJ/authorized_keys_$USER
cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER for t in ${SSH_KEYTYPES}; do
printf 'command="true" ' >>$OBJ/authorized_keys_$USER printf 'command="true" ' >>$OBJ/authorized_keys_$USER
cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
done
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "forced command in key option proto $p" trace "forced command in key option proto $p"
${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
fail "forced command in key proto $p" fail "forced command in key proto $p"
done done
printf 'command="false" ' >$OBJ/authorized_keys_$USER cp /dev/null $OBJ/authorized_keys_$USER
cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER for t in ${SSH_KEYTYPES}; do
printf 'command="false" ' >>$OBJ/authorized_keys_$USER printf 'command="false" ' >> $OBJ/authorized_keys_$USER
cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
done
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
echo "ForceCommand true" >> $OBJ/sshd_proxy echo "ForceCommand true" >> $OBJ/sshd_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "forced command in sshd_config overrides key option proto $p" trace "forced command in sshd_config overrides key option proto $p"
${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
fail "forced command in key proto $p" fail "forced command in key proto $p"
@ -35,7 +37,7 @@ echo "ForceCommand false" >> $OBJ/sshd_proxy
echo "Match User $USER" >> $OBJ/sshd_proxy echo "Match User $USER" >> $OBJ/sshd_proxy
echo " ForceCommand true" >> $OBJ/sshd_proxy echo " ForceCommand true" >> $OBJ/sshd_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "forced command with match proto $p" trace "forced command with match proto $p"
${SSH} -$p -F $OBJ/ssh_proxy somehost false \ || ${SSH} -$p -F $OBJ/ssh_proxy somehost false \ ||
fail "forced command in key proto $p" fail "forced command in key proto $p"

View File

@ -1,4 +1,4 @@
# $OpenBSD: forward-control.sh,v 1.2 2013/11/18 05:09:32 naddy Exp $ # $OpenBSD: forward-control.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="sshd control of local and remote forwarding" tid="sshd control of local and remote forwarding"
@ -99,7 +99,7 @@ cp ${OBJ}/sshd_proxy ${OBJ}/sshd_proxy.bak
cp ${OBJ}/authorized_keys_${USER} ${OBJ}/authorized_keys_${USER}.bak cp ${OBJ}/authorized_keys_${USER} ${OBJ}/authorized_keys_${USER}.bak
# Sanity check: ensure the default config allows forwarding # Sanity check: ensure the default config allows forwarding
for p in 1 2 ; do for p in ${SSH_PROTOCOLS} ; do
check_lfwd $p Y "proto $p, default configuration" check_lfwd $p Y "proto $p, default configuration"
check_rfwd $p Y "proto $p, default configuration" check_rfwd $p Y "proto $p, default configuration"
done done
@ -115,7 +115,7 @@ all_tests() {
_permit_rfwd=$7 _permit_rfwd=$7
_badfwd=127.0.0.1:22 _badfwd=127.0.0.1:22
_goodfwd=127.0.0.1:${PORT} _goodfwd=127.0.0.1:${PORT}
for _proto in 1 2 ; do for _proto in ${SSH_PROTOCOLS} ; do
cp ${OBJ}/authorized_keys_${USER}.bak \ cp ${OBJ}/authorized_keys_${USER}.bak \
${OBJ}/authorized_keys_${USER} ${OBJ}/authorized_keys_${USER}
_prefix="proto $_proto, AllowTcpForwarding=$_tcpfwd" _prefix="proto $_proto, AllowTcpForwarding=$_tcpfwd"

View File

@ -1,4 +1,4 @@
# $OpenBSD: forwarding.sh,v 1.14 2015/02/23 20:32:15 djm Exp $ # $OpenBSD: forwarding.sh,v 1.15 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="local and remote forwarding" tid="local and remote forwarding"
@ -23,8 +23,11 @@ for j in 0 1 2; do
last=$a last=$a
done done
done done
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
q=`expr 3 - $p` q=`expr 3 - $p`
if ! ssh_version $q; then
q=$p
fi
trace "start forwarding, fork to background" 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
@ -37,7 +40,7 @@ for p in 1 2; do
sleep 10 sleep 10
done done
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
for d in L R; do for d in L R; do
trace "exit on -$d forward failure, proto $p" trace "exit on -$d forward failure, proto $p"
@ -67,7 +70,7 @@ for d in L R; do
done done
done done
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "simple clear forwarding proto $p" trace "simple clear forwarding proto $p"
${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true
@ -110,7 +113,7 @@ done
echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config
echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
trace "config file: start forwarding, fork to background" trace "config file: start forwarding, fork to background"
${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f somehost sleep 10 ${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f somehost sleep 10

View File

@ -1,4 +1,4 @@
# $OpenBSD: host-expand.sh,v 1.3 2014/02/27 23:17:41 djm Exp $ # $OpenBSD: host-expand.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="expand %h and %n" tid="expand %h and %n"
@ -11,7 +11,7 @@ somehost
127.0.0.1 127.0.0.1
EOE EOE
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "test $tid: proto $p" verbose "test $tid: proto $p"
${SSH} -F $OBJ/ssh_proxy -$p somehost true >$OBJ/actual ${SSH} -F $OBJ/ssh_proxy -$p somehost true >$OBJ/actual
diff $OBJ/expect $OBJ/actual || fail "$tid proto $p" diff $OBJ/expect $OBJ/actual || fail "$tid proto $p"

View File

@ -1,4 +1,4 @@
# $OpenBSD: key-options.sh,v 1.2 2008/06/30 08:07:34 djm Exp $ # $OpenBSD: key-options.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="key options" tid="key options"
@ -8,7 +8,7 @@ authkeys="$OBJ/authorized_keys_${USER}"
cp $authkeys $origkeys cp $authkeys $origkeys
# Test command= forced command # Test command= forced command
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
sed "s/.*/$c &/" $origkeys >$authkeys sed "s/.*/$c &/" $origkeys >$authkeys
verbose "key option proto $p $c" verbose "key option proto $p $c"
@ -24,7 +24,7 @@ done
# Test no-pty # Test no-pty
sed 's/.*/no-pty &/' $origkeys >$authkeys sed 's/.*/no-pty &/' $origkeys >$authkeys
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "key option proto $p no-pty" verbose "key option proto $p no-pty"
r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost tty` r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost tty`
if [ -f "$r" ]; then if [ -f "$r" ]; then
@ -35,7 +35,7 @@ done
# Test environment= # Test environment=
echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy
sed 's/.*/environment="FOO=bar" &/' $origkeys >$authkeys sed 's/.*/environment="FOO=bar" &/' $origkeys >$authkeys
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "key option proto $p environment" verbose "key option proto $p environment"
r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost 'echo $FOO'` r=`${SSH} -$p -q -F $OBJ/ssh_proxy somehost 'echo $FOO'`
if [ "$r" != "bar" ]; then if [ "$r" != "bar" ]; then
@ -45,7 +45,7 @@ done
# Test from= restriction # Test from= restriction
start_sshd start_sshd
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
for f in 127.0.0.1 '127.0.0.0\/8'; do for f in 127.0.0.1 '127.0.0.0\/8'; do
cat $origkeys >$authkeys cat $origkeys >$authkeys
${SSH} -$p -q -F $OBJ/ssh_proxy somehost true ${SSH} -$p -q -F $OBJ/ssh_proxy somehost true

View File

@ -1,4 +1,4 @@
# $OpenBSD: keygen-change.sh,v 1.4 2015/01/13 08:23:26 djm Exp $ # $OpenBSD: keygen-change.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="change passphrase for key" tid="change passphrase for key"
@ -6,7 +6,12 @@ tid="change passphrase for key"
S1="secret1" S1="secret1"
S2="2secret" S2="2secret"
for t in `${SSH} -Q key-plain` ; do KEYTYPES=`${SSH} -Q key-plain`
if ssh_version 1; then
KEYTYPES="${KEYTYPES} rsa1"
fi
for t in $KEYTYPES; do
# generate user key for agent # generate user key for agent
trace "generating $t key" trace "generating $t key"
rm -f $OBJ/$t-key rm -f $OBJ/$t-key

View File

@ -1,4 +1,4 @@
# $OpenBSD: keyscan.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: keyscan.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="keyscan" tid="keyscan"
@ -8,7 +8,12 @@ rm -f ${OBJ}/host.dsa
start_sshd start_sshd
for t in rsa1 rsa dsa; do KEYTYPES="rsa dsa"
if ssh_version 1; then
KEYTYPES="${KEYTYPES} rsa1"
fi
for t in $KEYTYPES; do
trace "keyscan type $t" trace "keyscan type $t"
${SSHKEYSCAN} -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 > /dev/null 2>&1

View File

@ -1,4 +1,4 @@
# $OpenBSD: localcommand.sh,v 1.2 2013/05/17 10:24:48 dtucker Exp $ # $OpenBSD: localcommand.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="localcommand" tid="localcommand"
@ -6,7 +6,7 @@ tid="localcommand"
echo 'PermitLocalCommand yes' >> $OBJ/ssh_proxy echo 'PermitLocalCommand yes' >> $OBJ/ssh_proxy
echo 'LocalCommand echo foo' >> $OBJ/ssh_proxy echo 'LocalCommand echo foo' >> $OBJ/ssh_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "test $tid: proto $p localcommand" verbose "test $tid: proto $p localcommand"
a=`${SSH} -F $OBJ/ssh_proxy -$p somehost true` a=`${SSH} -F $OBJ/ssh_proxy -$p somehost true`
if [ "$a" != "foo" ] ; then if [ "$a" != "foo" ] ; then

View File

@ -1,4 +1,4 @@
# $OpenBSD: proto-mismatch.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: proto-mismatch.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="protocol version mismatch" tid="protocol version mismatch"
@ -16,4 +16,6 @@ mismatch ()
} }
mismatch 2 SSH-1.5-HALLO mismatch 2 SSH-1.5-HALLO
mismatch 1 SSH-2.0-HALLO if ssh_version 1; then
mismatch 1 SSH-2.0-HALLO
fi

View File

@ -1,4 +1,4 @@
# $OpenBSD: proto-version.sh,v 1.4 2013/05/17 00:37:40 dtucker Exp $ # $OpenBSD: proto-version.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="sshd version with different protocol combinations" tid="sshd version with different protocol combinations"
@ -28,7 +28,9 @@ check_version ()
fi fi
} }
check_version 2,1 199
check_version 1,2 199
check_version 2 20 check_version 2 20
check_version 1 15 if ssh_version 1; then
check_version 2,1 199
check_version 1,2 199
check_version 1 15
fi

View File

@ -1,4 +1,4 @@
# $OpenBSD: proxy-connect.sh,v 1.7 2014/05/03 18:46:14 dtucker Exp $ # $OpenBSD: proxy-connect.sh,v 1.8 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="proxy connect" tid="proxy connect"
@ -9,7 +9,7 @@ for ps in no yes; do
cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy echo "UsePrivilegeSeparation $ps" >> $OBJ/sshd_proxy
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
for c in no yes; do for c in no yes; do
verbose "plain username protocol $p privsep=$ps comp=$c" verbose "plain username protocol $p privsep=$ps comp=$c"
opts="-$p -oCompression=$c -F $OBJ/ssh_proxy" opts="-$p -oCompression=$c -F $OBJ/ssh_proxy"
@ -24,7 +24,7 @@ for ps in no yes; do
done done
done done
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "username with style protocol $p" verbose "username with style protocol $p"
${SSH} -$p -F $OBJ/ssh_proxy ${USER}:style@999.999.999.999 true || \ ${SSH} -$p -F $OBJ/ssh_proxy ${USER}:style@999.999.999.999 true || \
fail "ssh proxyconnect protocol $p failed" fail "ssh proxyconnect protocol $p failed"

View File

@ -1,4 +1,4 @@
# $OpenBSD: reconfigure.sh,v 1.4 2015/01/14 09:58:21 markus Exp $ # $OpenBSD: reconfigure.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="simple connect after reconfigure" tid="simple connect after reconfigure"
@ -18,7 +18,7 @@ fi
start_sshd start_sshd
trace "connect before restart" trace "connect before restart"
for p in 1 2; do for p in ${SSH_PROTOCOLS} ; 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 if [ $? -ne 0 ]; then
fail "ssh connect with protocol $p failed before reconfigure" fail "ssh connect with protocol $p failed before reconfigure"
@ -39,7 +39,7 @@ done
test -f $PIDFILE || fatal "sshd did not restart" test -f $PIDFILE || fatal "sshd did not restart"
trace "connect after restart" trace "connect after restart"
for p in 1 2; do for p in ${SSH_PROTOCOLS} ; 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 if [ $? -ne 0 ]; then
fail "ssh connect with protocol $p failed after reconfigure" fail "ssh connect with protocol $p failed after reconfigure"

View File

@ -1,4 +1,4 @@
# $OpenBSD: reexec.sh,v 1.7 2013/05/17 10:23:52 dtucker Exp $ # $OpenBSD: reexec.sh,v 1.8 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="reexec tests" tid="reexec tests"
@ -19,7 +19,7 @@ start_sshd_copy ()
copy_tests () copy_tests ()
{ {
rm -f ${COPY} rm -f ${COPY}
for p in 1 2; do for p in ${SSH_PROTOCOLS} ; do
verbose "$tid: proto $p" verbose "$tid: proto $p"
${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \
cat ${DATA} > ${COPY} cat ${DATA} > ${COPY}

View File

@ -1,10 +1,10 @@
# $OpenBSD: stderr-data.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $ # $OpenBSD: stderr-data.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="stderr data transfer" tid="stderr data transfer"
for n in '' -n; do for n in '' -n; do
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "test $tid: proto $p ($n)" verbose "test $tid: proto $p ($n)"
${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \ ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \ exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \

View File

@ -1,4 +1,4 @@
# $OpenBSD: test-exec.sh,v 1.48 2014/07/06 07:42:03 djm Exp $ # $OpenBSD: test-exec.sh,v 1.51 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
#SUDO=sudo #SUDO=sudo
@ -130,6 +130,11 @@ if [ "x$TEST_SSH_CONCH" != "x" ]; then
esac esac
fi fi
SSH_PROTOCOLS=`$SSH -Q protocol-version`
if [ "x$TEST_SSH_PROTOCOLS" != "x" ]; then
SSH_PROTOCOLS="${TEST_SSH_PROTOCOLS}"
fi
# Path to sshd must be absolute for rexec # Path to sshd must be absolute for rexec
case "$SSHD" in case "$SSHD" in
/*) ;; /*) ;;
@ -374,16 +379,27 @@ fatal ()
exit $RESULT exit $RESULT
} }
ssh_version ()
{
echo ${SSH_PROTOCOLS} | grep -q "$1"
}
RESULT=0 RESULT=0
PIDFILE=$OBJ/pidfile PIDFILE=$OBJ/pidfile
trap fatal 3 2 trap fatal 3 2
if ssh_version 1; then
PROTO="2,1"
else
PROTO="2"
fi
# create server config # create server config
cat << EOF > $OBJ/sshd_config cat << EOF > $OBJ/sshd_config
StrictModes no StrictModes no
Port $PORT Port $PORT
Protocol 2,1 Protocol $PROTO
AddressFamily inet AddressFamily inet
ListenAddress 127.0.0.1 ListenAddress 127.0.0.1
#ListenAddress ::1 #ListenAddress ::1
@ -409,7 +425,7 @@ echo 'StrictModes no' >> $OBJ/sshd_proxy
# create client config # create client config
cat << EOF > $OBJ/ssh_config cat << EOF > $OBJ/ssh_config
Host * Host *
Protocol 2,1 Protocol $PROTO
Hostname 127.0.0.1 Hostname 127.0.0.1
HostKeyAlias localhost-with-alias HostKeyAlias localhost-with-alias
Port $PORT Port $PORT
@ -434,8 +450,13 @@ fi
rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
if ssh_version 1; then
SSH_KEYTYPES="rsa rsa1"
else
SSH_KEYTYPES="rsa ed25519"
fi
trace "generate keys" trace "generate keys"
for t in rsa rsa1; do for t in ${SSH_KEYTYPES}; do
# generate user key # generate user key
if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN_BIN} -nt $OBJ/$t ]; then
rm -f $OBJ/$t rm -f $OBJ/$t

View File

@ -1,9 +1,9 @@
# $OpenBSD: transfer.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $ # $OpenBSD: transfer.sh,v 1.3 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="transfer data" tid="transfer data"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
verbose "$tid: proto $p" verbose "$tid: proto $p"
rm -f ${COPY} rm -f ${COPY}
${SSH} -n -q -$p -F $OBJ/ssh_proxy somehost cat ${DATA} > ${COPY} ${SSH} -n -q -$p -F $OBJ/ssh_proxy somehost cat ${DATA} > ${COPY}

View File

@ -1,4 +1,4 @@
# $OpenBSD: try-ciphers.sh,v 1.23 2014/04/21 22:15:37 djm Exp $ # $OpenBSD: try-ciphers.sh,v 1.24 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="try ciphers" tid="try ciphers"
@ -26,7 +26,11 @@ for c in `${SSH} -Q cipher`; do
done done
done done
ciphers="3des blowfish" if ssh_version 1; then
ciphers="3des blowfish"
else
ciphers=""
fi
for c in $ciphers; do for c in $ciphers; do
trace "proto 1 cipher $c" trace "proto 1 cipher $c"
verbose "test $tid: proto 1 cipher $c" verbose "test $tid: proto 1 cipher $c"

View File

@ -1,9 +1,9 @@
# $OpenBSD: yes-head.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ # $OpenBSD: yes-head.sh,v 1.5 2015/03/03 22:35:19 markus Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
tid="yes pipe head" tid="yes pipe head"
for p in 1 2; do for p in ${SSH_PROTOCOLS}; do
lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | _POSIX2_VERSION=199209 head -2000"' | (sleep 3 ; wc -l)` lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | _POSIX2_VERSION=199209 head -2000"' | (sleep 3 ; wc -l)`
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "yes|head test failed" fail "yes|head test failed"