summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile73
-rw-r--r--regress/agent.sh75
-rw-r--r--regress/authorized_keys_root2
-rw-r--r--regress/broken-pipe.sh15
-rw-r--r--regress/bsd.regress.mk79
-rw-r--r--regress/connect-privsep.sh13
-rw-r--r--regress/connect.sh13
-rwxr-xr-xregress/copy.1bin0 -> 45948 bytes
-rwxr-xr-xregress/copy.2bin0 -> 45948 bytes
-rw-r--r--regress/dsa_ssh2.prv14
-rw-r--r--regress/dsa_ssh2.pub13
-rw-r--r--regress/exit-status.sh24
-rw-r--r--regress/forwarding.sh33
-rw-r--r--regress/keyscan.sh19
-rw-r--r--regress/proto-mismatch.sh19
-rw-r--r--regress/proto-version.sh34
-rw-r--r--regress/proxy-connect.sh11
-rw-r--r--regress/rsa_openssh.prv15
-rw-r--r--regress/rsa_openssh.pub1
-rw-r--r--regress/rsa_ssh2.prv16
-rwxr-xr-xregress/runtests.sh13
-rw-r--r--regress/sftp.sh29
-rw-r--r--regress/ssh-com-client.sh127
-rw-r--r--regress/ssh-com-keygen.sh67
-rw-r--r--regress/ssh-com-sftp.sh54
-rw-r--r--regress/ssh-com.sh112
-rw-r--r--regress/stderr-after-eof.sh30
-rw-r--r--regress/stderr-data.sh33
-rw-r--r--regress/t4.ok1
-rw-r--r--regress/t5.ok1
-rw-r--r--regress/test-exec.sh224
-rw-r--r--regress/transfer.sh29
-rw-r--r--regress/try-ciphers.sh29
-rw-r--r--regress/yes-head.sh15
34 files changed, 1233 insertions, 0 deletions
diff --git a/regress/Makefile b/regress/Makefile
new file mode 100644
index 000000000..26224cd7d
--- /dev/null
+++ b/regress/Makefile
@@ -0,0 +1,73 @@
1# $OpenBSD: Makefile,v 1.13 2002/04/01 22:15:08 markus Exp $
2
3REGRESSTARGETS= t1 t2 t3 t4 t5 t6 t7
4
5CLEANFILES+= t2.out t6.out1 t6.out2 t7.out t7.out.pub
6
7LTESTS= connect \
8 proxy-connect \
9 connect-privsep \
10 proto-version \
11 proto-mismatch \
12 exit-status \
13 transfer \
14 stderr-data \
15 stderr-after-eof \
16 broken-pipe \
17 try-ciphers \
18 yes-head \
19 agent \
20 keyscan \
21 sftp \
22 forwarding
23
24USER!= id -un
25CLEANFILES+= authorized_keys_${USER} known_hosts pidfile \
26 ssh_config ssh_proxy sshd_config sshd_proxy \
27 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
28 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
29 ls.copy
30
31#LTESTS+= ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
32
33t1:
34 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
35
36t2:
37 cat ${.CURDIR}/rsa_openssh.prv > t2.out
38 chmod 600 t2.out
39 ssh-keygen -yf t2.out | diff - ${.CURDIR}/rsa_openssh.pub
40
41t3:
42 ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub |\
43 ssh-keygen -if /dev/stdin |\
44 diff - ${.CURDIR}/rsa_openssh.pub
45
46t4:
47 ssh-keygen -lf ${.CURDIR}/rsa_openssh.pub |\
48 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
49
50t5:
51 ssh-keygen -Bf ${.CURDIR}/rsa_openssh.pub |\
52 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
53
54t6:
55 ssh-keygen -if ${.CURDIR}/dsa_ssh2.prv > t6.out1
56 ssh-keygen -if ${.CURDIR}/dsa_ssh2.pub > t6.out2
57 chmod 600 t6.out1
58 ssh-keygen -yf t6.out1 | diff - t6.out2
59
60t7.out:
61 ssh-keygen -q -t rsa -N '' -f $@
62
63t7: t7.out
64 ssh-keygen -lf t7.out > /dev/null
65 ssh-keygen -Bf t7.out > /dev/null
66
67.for t in ${LTESTS}
68REGRESSTARGETS+=t-${t}
69t-${t}:
70 sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/${t}.sh
71.endfor
72
73.include "bsd.regress.mk"
diff --git a/regress/agent.sh b/regress/agent.sh
new file mode 100644
index 000000000..7e9b4cb18
--- /dev/null
+++ b/regress/agent.sh
@@ -0,0 +1,75 @@
1# $OpenBSD: agent.sh,v 1.6 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="simple agent test"
5
6SSH_AUTH_SOCK=/nonexistant ${SSHADD} -l > /dev/null 2>&1
7if [ $? -ne 2 ]; then
8 fail "ssh-add -l did not fail with exit code 2"
9fi
10
11trace "start agent"
12eval `${SSHAGENT} -s` > /dev/null
13r=$?
14if [ $r -ne 0 ]; then
15 fail "could not start ssh-agent: exit code $r"
16else
17 ${SSHADD} -l > /dev/null 2>&1
18 if [ $? -ne 1 ]; then
19 fail "ssh-add -l did not fail with exit code 1"
20 fi
21 trace "overwrite authorized keys"
22 echo -n > $OBJ/authorized_keys_$USER
23 for t in rsa rsa1; do
24 # generate user key for agent
25 rm -f $OBJ/$t-agent
26 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t-agent ||\
27 fail "ssh-keygen for $t-agent failed"
28 # add to authorized keys
29 cat $OBJ/$t-agent.pub >> $OBJ/authorized_keys_$USER
30 # add privat key to agent
31 ${SSHADD} $OBJ/$t-agent > /dev/null 2>&1
32 if [ $? -ne 0 ]; then
33 fail "ssh-add did succeed exit code 0"
34 fi
35 done
36 ${SSHADD} -l > /dev/null 2>&1
37 if [ $? -ne 0 ]; then
38 fail "ssh-add -l failed: exit code $?"
39 fi
40 # the same for full pubkey output
41 ${SSHADD} -L > /dev/null 2>&1
42 if [ $? -ne 0 ]; then
43 fail "ssh-add -L failed: exit code $?"
44 fi
45
46 trace "simple connect via agent"
47 for p in 1 2; do
48 ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p
49 if [ $? -ne 5$p ]; then
50 fail "ssh connect with protocol $p failed (exit code $?)"
51 fi
52 done
53
54 trace "agent forwarding"
55 for p in 1 2; do
56 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1
57 if [ $? -ne 0 ]; then
58 fail "ssh-add -l via agent fwd proto $p failed (exit code $?)"
59 fi
60 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \
61 "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p"
62 if [ $? -ne 5$p ]; then
63 fail "agent fwd proto $p failed (exit code $?)"
64 fi
65 done
66
67 trace "delete all agent keys"
68 ${SSHADD} -D > /dev/null 2>&1
69 if [ $? -ne 0 ]; then
70 fail "ssh-add -D failed: exit code $?"
71 fi
72
73 trace "kill agent"
74 ${SSHAGENT} -k > /dev/null
75fi
diff --git a/regress/authorized_keys_root b/regress/authorized_keys_root
new file mode 100644
index 000000000..328537120
--- /dev/null
+++ b/regress/authorized_keys_root
@@ -0,0 +1,2 @@
1ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAt6ttBacbgvLPsF1VWWfT51t55/5Mj62Xp8EaoH5SNSaLiGIgrrja077lKEept75U4uKFUYU5JJX9GPE9A7Y43LXv+/A6Jm4rEj/U0s4H8tf0UmzVC3t6xh0sRK0hYVNILyoHnIAgdY8CmOiybw7p6DxJY8MRAehD3n9+kFcachU= root@xenon
21024 35 132789427207755621599908461558918671787816692978751485815532032934821830960131244604702969298486352138126114080367609979552547448841583955126231410604842765726397407176910594168641969541792069550006878863592030567875913190224374005367884774859544943329148178663694126456638431428703289837638970464685771819219 root@xenon
diff --git a/regress/broken-pipe.sh b/regress/broken-pipe.sh
new file mode 100644
index 000000000..c08c849a7
--- /dev/null
+++ b/regress/broken-pipe.sh
@@ -0,0 +1,15 @@
1# $OpenBSD: broken-pipe.sh,v 1.4 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="broken pipe test"
5
6for p in 1 2; do
7 trace "protocol $p"
8 for i in 1 2 3 4; do
9 ${SSH} -$p -F $OBJ/ssh_config_config nexthost echo $i 2> /dev/null | true
10 r=$?
11 if [ $r -ne 0 ]; then
12 fail "broken pipe returns $r for protocol $p"
13 fi
14 done
15done
diff --git a/regress/bsd.regress.mk b/regress/bsd.regress.mk
new file mode 100644
index 000000000..9b8011a01
--- /dev/null
+++ b/regress/bsd.regress.mk
@@ -0,0 +1,79 @@
1# $OpenBSD: bsd.regress.mk,v 1.9 2002/02/17 01:10:15 marc Exp $
2# No man pages for regression tests.
3NOMAN=
4
5# No installation.
6install:
7
8# If REGRESSTARGETS is defined and PROG is not defined, set NOPROG
9.if defined(REGRESSTARGETS) && !defined(PROG)
10NOPROG=
11.endif
12
13.include <bsd.prog.mk>
14
15.MAIN: all
16all: regress
17
18# XXX - Need full path to REGRESSLOG, otherwise there will be much pain.
19
20REGRESSLOG?=/dev/null
21REGRESSNAME=${.CURDIR:S/${BSDSRCDIR}\/regress\///}
22
23.if defined(PROG) && !empty(PROG)
24run-regress-${PROG}: ${PROG}
25 ./${PROG}
26.endif
27
28.if !defined(REGRESSTARGETS)
29REGRESSTARGETS=run-regress-${PROG}
30. if defined(REGRESSSKIP)
31REGRESSSKIPTARGETS=run-regress-${PROG}
32. endif
33.endif
34
35REGRESSSKIPSLOW?=no
36
37#.if (${REGRESSSKIPSLOW:L} == "yes") && defined(REGRESSSLOWTARGETS)
38
39.if (${REGRESSSKIPSLOW} == "yes") && defined(REGRESSSLOWTARGETS)
40REGRESSSKIPTARGETS+=${REGRESSSLOWTARGETS}
41.endif
42
43.if defined(REGRESSROOTTARGETS)
44ROOTUSER!=id -g
45SUDO?=
46. if (${ROOTUSER} != 0) && empty(SUDO)
47REGRESSSKIPTARGETS+=${REGRESSROOTTARGETS}
48. endif
49.endif
50
51REGRESSSKIPTARGETS?=
52
53regress:
54.for RT in ${REGRESSTARGETS}
55. if ${REGRESSSKIPTARGETS:M${RT}}
56 @echo -n "SKIP " >> ${REGRESSLOG}
57. else
58# XXX - we need a better method to see if a test fails due to timeout or just
59# normal failure.
60. if !defined(REGRESSMAXTIME)
61 @if cd ${.CURDIR} && ${MAKE} ${RT}; then \
62 echo -n "SUCCESS " >> ${REGRESSLOG} ; \
63 else \
64 echo -n "FAIL " >> ${REGRESSLOG} ; \
65 echo FAILED ; \
66 fi
67. else
68 @if cd ${.CURDIR} && (ulimit -t ${REGRESSMAXTIME} ; ${MAKE} ${RT}); then \
69 echo -n "SUCCESS " >> ${REGRESSLOG} ; \
70 else \
71 echo -n "FAIL (possible timeout) " >> ${REGRESSLOG} ; \
72 echo FAILED ; \
73 fi
74. endif
75. endif
76 @echo ${REGRESSNAME}/${RT:S/^run-regress-//} >> ${REGRESSLOG}
77.endfor
78
79.PHONY: regress
diff --git a/regress/connect-privsep.sh b/regress/connect-privsep.sh
new file mode 100644
index 000000000..d23cadba5
--- /dev/null
+++ b/regress/connect-privsep.sh
@@ -0,0 +1,13 @@
1# $OpenBSD: connect-privsep.sh,v 1.1 2002/03/21 21:45:07 markus Exp $
2# Placed in the Public Domain.
3
4tid="proxy connect with privsep"
5
6echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy
7
8for p in 1 2; do
9 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
10 if [ $? -ne 0 ]; then
11 fail "ssh privsep+proxyconnect protocol $p failed"
12 fi
13done
diff --git a/regress/connect.sh b/regress/connect.sh
new file mode 100644
index 000000000..2186fa6e7
--- /dev/null
+++ b/regress/connect.sh
@@ -0,0 +1,13 @@
1# $OpenBSD: connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="simple connect"
5
6start_sshd
7
8for p in 1 2; do
9 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
10 if [ $? -ne 0 ]; then
11 fail "ssh connect with protocol $p failed"
12 fi
13done
diff --git a/regress/copy.1 b/regress/copy.1
new file mode 100755
index 000000000..92d4d20f9
--- /dev/null
+++ b/regress/copy.1
Binary files differ
diff --git a/regress/copy.2 b/regress/copy.2
new file mode 100755
index 000000000..92d4d20f9
--- /dev/null
+++ b/regress/copy.2
Binary files differ
diff --git a/regress/dsa_ssh2.prv b/regress/dsa_ssh2.prv
new file mode 100644
index 000000000..c93b40371
--- /dev/null
+++ b/regress/dsa_ssh2.prv
@@ -0,0 +1,14 @@
1---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----
2Subject: ssh-keygen test
3Comment: "1024-bit dsa, Tue Jan 08 2002 22:00:23 +0100"
4P2/56wAAAgIAAAAmZGwtbW9kcHtzaWdue2RzYS1uaXN0LXNoYTF9LGRoe3BsYWlufX0AAA
5AEbm9uZQAAAcQAAAHAAAAAAAAABACwUfm3AxZTut3icBmwCcD48nY64HzuELlQ+vEqjIcR
6Lo49es/DQTeLNQ+kdKRCfouosGNv0WqxRtF0tUsWdXxS37oHGa4QPugBdHRd7YlZGZv8kg
7x7FsoepY7v7E683/97dv2zxL3AGagTEzWr7fl0yPexAaZoDvtQrrjX44BLmwAABACWQkvv
8MxnD8eFkS1konFfMJ1CkuRfTN34CBZ6dY7VTSGemy4QwtFdMKmoufD0eKgy3p5WOeWCYKt
9F4FhjHKZk/aaxFjjIbtkrnlvXg64QI11dSZyBN6/ViQkHPSkUDF+A6AAEhrNbQbAFSvao1
10kTvNtPCtL0AkUIduEMzGQfLCTAAAAKDeC043YVo9Zo0zAEeIA4uZh4LBCQAAA/9aj7Y5ik
11ehygJ4qTDSlVypsPuV+n59tMS0e2pfrSG87yf5r94AKBmJeho5OO6wYaXCxsVB7AFbSUD6
1275AK8mHF4v1/+7SWKk5f8xlMCMSPZ9K0+j/W1d/q2qkhnnDZolOHDomLA+U00i5ya/jnTV
13zyDPWLFpWK8u3xGBPAYX324gAAAKDHFvooRnaXdZbeWGTTqmgHB1GU9A==
14---- END SSH2 ENCRYPTED PRIVATE KEY ----
diff --git a/regress/dsa_ssh2.pub b/regress/dsa_ssh2.pub
new file mode 100644
index 000000000..215d73bae
--- /dev/null
+++ b/regress/dsa_ssh2.pub
@@ -0,0 +1,13 @@
1---- BEGIN SSH2 PUBLIC KEY ----
2Subject: ssh-keygen test
3Comment: "1024-bit dsa, Tue Jan 08 2002 22:00:23 +0100"
4AAAAB3NzaC1kc3MAAACBALBR+bcDFlO63eJwGbAJwPjydjrgfO4QuVD68SqMhxEujj16z8
5NBN4s1D6R0pEJ+i6iwY2/RarFG0XS1SxZ1fFLfugcZrhA+6AF0dF3tiVkZm/ySDHsWyh6l
6ju/sTrzf/3t2/bPEvcAZqBMTNavt+XTI97EBpmgO+1CuuNfjgEubAAAAFQDeC043YVo9Zo
70zAEeIA4uZh4LBCQAAAIEAlkJL7zMZw/HhZEtZKJxXzCdQpLkX0zd+AgWenWO1U0hnpsuE
8MLRXTCpqLnw9HioMt6eVjnlgmCrReBYYxymZP2msRY4yG7ZK55b14OuECNdXUmcgTev1Yk
9JBz0pFAxfgOgABIazW0GwBUr2qNZE7zbTwrS9AJFCHbhDMxkHywkwAAACAWo+2OYpHocoC
10eKkw0pVcqbD7lfp+fbTEtHtqX60hvO8n+a/eACgZiXoaOTjusGGlwsbFQewBW0lA+u+QCv
11JhxeL9f/u0lipOX/MZTAjEj2fStPo/1tXf6tqpIZ5w2aJThw6JiwPlNNIucmv4501c8gz1
12ixaVivLt8RgTwGF99uI=
13---- END SSH2 PUBLIC KEY ----
diff --git a/regress/exit-status.sh b/regress/exit-status.sh
new file mode 100644
index 000000000..56b78a622
--- /dev/null
+++ b/regress/exit-status.sh
@@ -0,0 +1,24 @@
1# $OpenBSD: exit-status.sh,v 1.6 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="remote exit status"
5
6for p in 1 2; do
7 for s in 0 1 4 5 44; do
8 trace "proto $p status $s"
9 verbose "test $tid: proto $p status $s"
10 ${SSH} -$p -F $OBJ/ssh_proxy otherhost exit $s
11 r=$?
12 if [ $r -ne $s ]; then
13 fail "exit code mismatch for protocol $p: $r != $s"
14 fi
15
16 # same with early close of stdout/err
17 ${SSH} -$p -F $OBJ/ssh_proxy -n otherhost \
18 exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\'
19 r=$?
20 if [ $r -ne $s ]; then
21 fail "exit code (with sleep) mismatch for protocol $p: $r != $s"
22 fi
23 done
24done
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
new file mode 100644
index 000000000..7b281c013
--- /dev/null
+++ b/regress/forwarding.sh
@@ -0,0 +1,33 @@
1# $OpenBSD: forwarding.sh,v 1.4 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="local and remote forwarding"
5
6start_sshd
7
8base=33
9last=$PORT
10fwd=""
11for j in 0 1 2; do
12 for i in 0 1 2; do
13 a=$base$j$i
14 b=`expr $a + 50`
15 c=$last
16 # fwd chain: $a -> $b -> $c
17 fwd="$fwd -L$a:127.0.0.1:$b -R$b:127.0.0.1:$c"
18 last=$a
19 done
20done
21for p in 1 2; do
22 q=`expr 3 - $p`
23 trace "start forwarding, fork to background"
24 ${SSH} -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10
25
26 trace "transfer over forwarded channels and check result"
27 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
28 somehost cat /bin/ls > $OBJ/ls.copy
29 test -f $OBJ/ls.copy || fail "failed copy /bin/ls"
30 cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
31
32 sleep 10
33done
diff --git a/regress/keyscan.sh b/regress/keyscan.sh
new file mode 100644
index 000000000..33f14f0fc
--- /dev/null
+++ b/regress/keyscan.sh
@@ -0,0 +1,19 @@
1# $OpenBSD: keyscan.sh,v 1.3 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="keyscan"
5
6# remove DSA hostkey
7rm -f ${OBJ}/host.dsa
8
9start_sshd
10
11for t in rsa1 rsa dsa; do
12 trace "keyscan type $t"
13 ${SSHKEYSCAN} -t $t -p $PORT 127.0.0.1 127.0.0.1 127.0.0.1 \
14 > /dev/null 2>&1
15 r=$?
16 if [ $r -ne 0 ]; then
17 fail "ssh-keyscan -t $t failed with: $r"
18 fi
19done
diff --git a/regress/proto-mismatch.sh b/regress/proto-mismatch.sh
new file mode 100644
index 000000000..fb521f214
--- /dev/null
+++ b/regress/proto-mismatch.sh
@@ -0,0 +1,19 @@
1# $OpenBSD: proto-mismatch.sh,v 1.3 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="protocol version mismatch"
5
6mismatch ()
7{
8 server=$1
9 client=$2
10 banner=`echo ${client} | ${SSHD} -o "Protocol=${server}" -i -f ${OBJ}/sshd_proxy`
11 r=$?
12 trace "sshd prints ${banner}"
13 if [ $r -ne 255 ]; then
14 fail "sshd prints ${banner} and accepts connect with version ${client}"
15 fi
16}
17
18mismatch 2 SSH-1.5-HALLO
19mismatch 1 SSH-2.0-HALLO
diff --git a/regress/proto-version.sh b/regress/proto-version.sh
new file mode 100644
index 000000000..7dc616f5f
--- /dev/null
+++ b/regress/proto-version.sh
@@ -0,0 +1,34 @@
1# $OpenBSD: proto-version.sh,v 1.3 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="sshd version with different protocol combinations"
5
6# we just start sshd in inetd mode and check the banner
7check_version ()
8{
9 version=$1
10 expect=$2
11 banner=`echo -n | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy`
12 case ${banner} in
13 SSH-1.99-*)
14 proto=199
15 ;;
16 SSH-2.0-*)
17 proto=20
18 ;;
19 SSH-1.5-*)
20 proto=15
21 ;;
22 *)
23 proto=0
24 ;;
25 esac
26 if [ ${expect} -ne ${proto} ]; then
27 fail "wrong protocol version ${banner} for ${version}"
28 fi
29}
30
31check_version 2,1 199
32check_version 1,2 199
33check_version 2 20
34check_version 1 15
diff --git a/regress/proxy-connect.sh b/regress/proxy-connect.sh
new file mode 100644
index 000000000..bf1940fcc
--- /dev/null
+++ b/regress/proxy-connect.sh
@@ -0,0 +1,11 @@
1# $OpenBSD: proxy-connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="proxy connect"
5
6for p in 1 2; do
7 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
8 if [ $? -ne 0 ]; then
9 fail "ssh proxyconnect protocol $p failed"
10 fi
11done
diff --git a/regress/rsa_openssh.prv b/regress/rsa_openssh.prv
new file mode 100644
index 000000000..267555572
--- /dev/null
+++ b/regress/rsa_openssh.prv
@@ -0,0 +1,15 @@
1-----BEGIN RSA PRIVATE KEY-----
2MIICWgIBAAKBgQDsilwKcaKN6wSMNd1WgQ9+HRqQEkD0kCTVttrazGu0OhBU3Uko
3+dFD1Ip0CxdXmN25JQWxOYF7h/Ocu8P3jzv3RTX87xKR0YzlXTLX+SLtF/ySebS3
4xWPrlfRUDhh03hR5V+8xxvvy9widPYKw/oItwGSueOsEq1LTczCDv2dAjQIDAQAB
5An8nH5VzvHkMbSqJ6eOYDsVwomRvYbH5IEaYl1x6VATITNvAu9kUdQ4NsSpuMc+7
6Jj9gKZvmO1y2YCKc0P/iO+i/eV0L+yQh1Rw18jQZll+12T+LZrKRav03YNvMx0gN
7wqWY48Kt6hv2/N/ebQzKRe79+D0t2cTh92hT7xENFLIBAkEBGnoGKFjAUkJCwO1V
8mzpUqMHpRZVOrqP9hUmPjzNJ5oBPFGe4+h1hoSRFOAzaNuZt8ssbqaLCkzB8bfzj
9qhZqAQJBANZekuUpp8iBLeLSagw5FkcPwPzq6zfExbhvsZXb8Bo/4SflNs4JHXwI
107SD9Z8aJLvM4uQ/5M70lblDMQ40i3o0CQQDIJvBYBFL5tlOgakq/O7yi+wt0L5BZ
119H79w5rCSAA0IHRoK/qI1urHiHC3f3vbbLk5UStfrqEaND/mm0shyNIBAkBLsYdC
12/ctt5Bc0wUGK4Vl5bBmj9LtrrMJ4FpBpLwj/69BwCuKoK9XKZ0h73p6XHveCEGRg
13PIlFX4MtaoLrwgU9AkBV2k4dgIws+X8YX65EsyyFjnlDqX4x0nSOjQB1msIKfHBr
14dh5XLDBTTCxnKhMJ0Yx/opgOvf09XHBFwaQntR5i
15-----END RSA PRIVATE KEY-----
diff --git a/regress/rsa_openssh.pub b/regress/rsa_openssh.pub
new file mode 100644
index 000000000..b504730f3
--- /dev/null
+++ b/regress/rsa_openssh.pub
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDsilwKcaKN6wSMNd1WgQ9+HRqQEkD0kCTVttrazGu0OhBU3Uko+dFD1Ip0CxdXmN25JQWxOYF7h/Ocu8P3jzv3RTX87xKR0YzlXTLX+SLtF/ySebS3xWPrlfRUDhh03hR5V+8xxvvy9widPYKw/oItwGSueOsEq1LTczCDv2dAjQ==
diff --git a/regress/rsa_ssh2.prv b/regress/rsa_ssh2.prv
new file mode 100644
index 000000000..1ece3d7de
--- /dev/null
+++ b/regress/rsa_ssh2.prv
@@ -0,0 +1,16 @@
1---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----
2Subject: ssh-keygen test
3Comment: "1024-bit rsa, Sat Jun 23 2001 12:21:26 -0400"
4P2/56wAAAi4AAAA3aWYtbW9kbntzaWdue3JzYS1wa2NzMS1zaGExfSxlbmNyeXB0e3JzYS
51wa2NzMXYyLW9hZXB9fQAAAARub25lAAAB3wAAAdsAAAARAQABAAAD9icflXO8eQxtKonp
645gOxXCiZG9hsfkgRpiXXHpUBMhM28C72RR1Dg2xKm4xz7smP2Apm+Y7XLZgIpzQ/+I76L
795XQv7JCHVHDXyNBmWX7XZP4tmspFq/Tdg28zHSA3CpZjjwq3qG/b8395tDMpF7v34PS3Z
8xOH3aFPvEQ0UsgEAAAQA7IpcCnGijesEjDXdVoEPfh0akBJA9JAk1bba2sxrtDoQVN1JKP
9nRQ9SKdAsXV5jduSUFsTmBe4fznLvD948790U1/O8SkdGM5V0y1/ki7Rf8knm0t8Vj65X0
10VA4YdN4UeVfvMcb78vcInT2CsP6CLcBkrnjrBKtS03Mwg79nQI0AAAH/VdpOHYCMLPl/GF
11+uRLMshY55Q6l+MdJ0jo0AdZrCCnxwa3YeVywwU0wsZyoTCdGMf6KYDr39PVxwRcGkJ7Ue
12YgAAAgDWXpLlKafIgS3i0moMORZHD8D86us3xMW4b7GV2/AaP+En5TbOCR18CO0g/WfGiS
137zOLkP+TO9JW5QzEONIt6NAAACAQEaegYoWMBSQkLA7VWbOlSowelFlU6uo/2FSY+PM0nm
14gE8UZ7j6HWGhJEU4DNo25m3yyxuposKTMHxt/OOqFmoB
15---- END SSH2 ENCRYPTED PRIVATE KEY ----
16---
diff --git a/regress/runtests.sh b/regress/runtests.sh
new file mode 100755
index 000000000..9808eb8a7
--- /dev/null
+++ b/regress/runtests.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2
3TEST_SSH_SSH=../ssh
4TEST_SSH_SSHD=../sshd
5TEST_SSH_SSHAGENT=../ssh-agent
6TEST_SSH_SSHADD=../ssh-add
7TEST_SSH_SSHKEYGEN=../ssh-keygen
8TEST_SSH_SSHKEYSCAN=../ssh-keyscan
9TEST_SSH_SFTP=../sftp
10TEST_SSH_SFTPSERVER=../sftp-server
11
12pmake
13
diff --git a/regress/sftp.sh b/regress/sftp.sh
new file mode 100644
index 000000000..e8d473123
--- /dev/null
+++ b/regress/sftp.sh
@@ -0,0 +1,29 @@
1# $OpenBSD: sftp.sh,v 1.2 2002/03/27 22:39:52 markus Exp $
2# Placed in the Public Domain.
3
4tid="basic sftp put/get"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9BUFFERSIZE="5 1000 32000 64000"
10REQUESTS="1 2 10"
11
12for B in ${BUFFERSIZE}; do
13 for R in ${REQUESTS}; do
14 verbose "test $tid: buffer_size $B num_requests $R"
15 rm -f ${COPY}.1 ${COPY}.2
16 ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b /dev/stdin \
17 > /dev/null 2>&1 << EOF
18 version
19 get $DATA ${COPY}.1
20 put $DATA ${COPY}.2
21EOF
22 r=$?
23 if [ $r -ne 0 ]; then
24 fail "sftp failed with $r"
25 fi
26 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
27 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
28 done
29done
diff --git a/regress/ssh-com-client.sh b/regress/ssh-com-client.sh
new file mode 100644
index 000000000..84b0b471e
--- /dev/null
+++ b/regress/ssh-com-client.sh
@@ -0,0 +1,127 @@
1# $OpenBSD: ssh-com-client.sh,v 1.3 2002/04/10 08:45:30 markus Exp $
2# Placed in the Public Domain.
3
4tid="connect with ssh.com client"
5
6#TEST_COMBASE=/path/to/ssh/com/binaries
7if [ "X${TEST_COMBASE}" = "X" ]; then
8 fatal '$TEST_COMBASE is not set'
9fi
10
11VERSIONS="
12 2.1.0
13 2.2.0
14 2.3.0
15 2.3.1
16 2.4.0
17 3.0.0
18 3.1.0"
19
20# 2.0.10 2.0.12 2.0.13 don't like the test setup
21
22# setup authorized keys
23SRC=`dirname ${SCRIPT}`
24cp ${SRC}/dsa_ssh2.prv ${OBJ}/id.com
25chmod 600 ${OBJ}/id.com
26${SSHKEYGEN} -i -f ${OBJ}/id.com > $OBJ/id.openssh
27chmod 600 ${OBJ}/id.openssh
28${SSHKEYGEN} -y -f ${OBJ}/id.openssh > $OBJ/authorized_keys_$USER
29${SSHKEYGEN} -e -f ${OBJ}/id.openssh > $OBJ/id.com.pub
30echo IdKey ${OBJ}/id.com > ${OBJ}/id.list
31
32# we need a DSA host key
33t=dsa
34rm -f ${OBJ}/$t ${OBJ}/$t.pub
35${SSHKEYGEN} -q -N '' -t $t -f ${OBJ}/$t
36$SUDO cp $OBJ/$t $OBJ/host.$t
37echo HostKey $OBJ/host.$t >> $OBJ/sshd_config
38
39# add hostkeys to known hosts
40mkdir -p ${OBJ}/${USER}/hostkeys
41HK=${OBJ}/${USER}/hostkeys/key_${PORT}_127.0.0.1
42${SSHKEYGEN} -e -f ${OBJ}/rsa.pub > ${HK}.ssh-rsa.pub
43${SSHKEYGEN} -e -f ${OBJ}/dsa.pub > ${HK}.ssh-dss.pub
44
45cat > ${OBJ}/ssh2_config << EOF
46*:
47 QuietMode yes
48 StrictHostKeyChecking yes
49 Port ${PORT}
50 User ${USER}
51 Host 127.0.0.1
52 IdentityFile ${OBJ}/id.list
53 RandomSeedFile ${OBJ}/random_seed
54 UserConfigDirectory ${OBJ}/%U
55 AuthenticationSuccessMsg no
56 BatchMode yes
57 ForwardX11 no
58EOF
59
60# we need a real server (no ProxyConnect option)
61start_sshd
62
63DATA=/bin/ls
64COPY=${OBJ}/copy
65rm -f ${COPY}
66
67# go for it
68for v in ${VERSIONS}; do
69 ssh2=${TEST_COMBASE}/${v}/ssh2
70 if [ ! -x ${ssh2} ]; then
71 continue
72 fi
73 verbose "ssh2 ${v}"
74 key=ssh-dss
75 skipcat=0
76 case $v in
77 2.1.*|2.3.0)
78 skipcat=1
79 ;;
80 3.0.*)
81 key=ssh-rsa
82 ;;
83 esac
84 cp ${HK}.$key.pub ${HK}.pub
85
86 # check exit status
87 ${ssh2} -q -F ${OBJ}/ssh2_config somehost exit 42
88 r=$?
89 if [ $r -ne 42 ]; then
90 fail "ssh2 ${v} exit code test failed (got $r, expected 42)"
91 fi
92
93 # data transfer
94 rm -f ${COPY}
95 ${ssh2} -F ${OBJ}/ssh2_config somehost cat ${DATA} > ${COPY}
96 if [ $? -ne 0 ]; then
97 fail "ssh2 ${v} cat test (receive) failed"
98 fi
99 cmp ${DATA} ${COPY} || fail "ssh2 ${v} cat test (receive) data mismatch"
100
101 # data transfer, again
102 if [ $skipcat -eq 0 ]; then
103 rm -f ${COPY}
104 cat ${DATA} | \
105 ${ssh2} -F ${OBJ}/ssh2_config host "cat > ${COPY}"
106 if [ $? -ne 0 ]; then
107 fail "ssh2 ${v} cat test (send) failed"
108 fi
109 cmp ${DATA} ${COPY} || \
110 fail "ssh2 ${v} cat test (send) data mismatch"
111 fi
112
113 # no stderr after eof
114 rm -f ${COPY}
115 ${ssh2} -F ${OBJ}/ssh2_config somehost \
116 exec sh -c \'"exec > /dev/null; sleep 1; echo bla 1>&2; exit 0"\' \
117 2> /dev/null
118 if [ $? -ne 0 ]; then
119 fail "ssh2 ${v} stderr test failed"
120 fi
121done
122
123rm -rf ${OBJ}/${USER}
124for i in ssh2_config random_seed dsa.pub dsa host.dsa \
125 id.list id.com id.com.pub id.openssh; do
126 rm -f ${OBJ}/$i
127done
diff --git a/regress/ssh-com-keygen.sh b/regress/ssh-com-keygen.sh
new file mode 100644
index 000000000..90ba2fcdc
--- /dev/null
+++ b/regress/ssh-com-keygen.sh
@@ -0,0 +1,67 @@
1# $OpenBSD: ssh-com-keygen.sh,v 1.1 2002/03/27 22:40:27 markus Exp $
2# Placed in the Public Domain.
3
4tid="ssh.com key import"
5
6#TEST_COMBASE=/path/to/ssh/com/binaries
7if [ "X${TEST_COMBASE}" = "X" ]; then
8 fatal '$TEST_COMBASE is not set'
9fi
10
11VERSIONS="
12 2.0.10
13 2.0.12
14 2.0.13
15 2.1.0
16 2.2.0
17 2.3.0
18 2.3.1
19 2.4.0
20 3.0.0
21 3.1.0"
22
23COMPRV=${OBJ}/comkey
24COMPUB=${COMPRV}.pub
25OPENSSHPRV=${OBJ}/opensshkey
26OPENSSHPUB=${OPENSSHPRV}.pub
27
28# go for it
29for v in ${VERSIONS}; do
30 keygen=${TEST_COMBASE}/${v}/ssh-keygen2
31 if [ ! -x ${keygen} ]; then
32 continue
33 fi
34 types="dss"
35 case $v in
36 2.3.1|3.*)
37 types="$types rsa"
38 ;;
39 esac
40 for t in $types; do
41 verbose "ssh-keygen $v/$t"
42 rm -f $COMPRV $COMPUB $OPENSSHPRV $OPENSSHPUB
43 ${keygen} -q -P -t $t ${COMPRV} > /dev/null 2>&1
44 if [ $? -ne 0 ]; then
45 fail "${keygen} -t $t failed"
46 continue
47 fi
48 ${SSHKEYGEN} -if ${COMPUB} > ${OPENSSHPUB}
49 if [ $? -ne 0 ]; then
50 fail "import public key ($v/$t) failed"
51 continue
52 fi
53 ${SSHKEYGEN} -if ${COMPRV} > ${OPENSSHPRV}
54 if [ $? -ne 0 ]; then
55 fail "import private key ($v/$t) failed"
56 continue
57 fi
58 chmod 600 ${OPENSSHPRV}
59 ${SSHKEYGEN} -yf ${OPENSSHPRV} |\
60 diff - ${OPENSSHPUB}
61 if [ $? -ne 0 ]; then
62 fail "public keys ($v/$t) differ"
63 fi
64 done
65done
66
67rm -f $COMPRV $COMPUB $OPENSSHPRV $OPENSSHPUB
diff --git a/regress/ssh-com-sftp.sh b/regress/ssh-com-sftp.sh
new file mode 100644
index 000000000..231efa132
--- /dev/null
+++ b/regress/ssh-com-sftp.sh
@@ -0,0 +1,54 @@
1# $OpenBSD: ssh-com-sftp.sh,v 1.2 2002/04/10 08:45:30 markus Exp $
2# Placed in the Public Domain.
3
4tid="basic sftp put/get with ssh.com server"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9BUFFERSIZE="5 1000 32000 64000"
10REQUESTS="1 2 10"
11
12#TEST_COMBASE=/path/to/ssh/com/binaries
13if [ "X${TEST_COMBASE}" = "X" ]; then
14 fatal '$TEST_COMBASE is not set'
15fi
16
17VERSIONS="
18 2.0.10
19 2.0.12
20 2.0.13
21 2.1.0
22 2.2.0
23 2.3.0
24 2.3.1
25 2.4.0
26 3.0.0
27 3.1.0"
28
29# go for it
30for v in ${VERSIONS}; do
31 server=${TEST_COMBASE}/${v}/sftp-server2
32 if [ ! -x ${server} ]; then
33 continue
34 fi
35 verbose "sftp-server $v"
36 for B in ${BUFFERSIZE}; do
37 for R in ${REQUESTS}; do
38 verbose "test $tid: buffer_size $B num_requests $R"
39 rm -f ${COPY}.1 ${COPY}.2
40 ${SFTP} -P ${server} -B $B -R $R -b /dev/stdin \
41 > /dev/null 2>&1 << EOF
42 version
43 get $DATA ${COPY}.1
44 put $DATA ${COPY}.2
45EOF
46 r=$?
47 if [ $r -ne 0 ]; then
48 fail "sftp failed with $r"
49 fi
50 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
51 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
52 done
53 done
54done
diff --git a/regress/ssh-com.sh b/regress/ssh-com.sh
new file mode 100644
index 000000000..6a199fa65
--- /dev/null
+++ b/regress/ssh-com.sh
@@ -0,0 +1,112 @@
1# $OpenBSD: ssh-com.sh,v 1.3 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="connect to ssh.com server"
5
6#TEST_COMBASE=/path/to/ssh/com/binaries
7if [ "X${TEST_COMBASE}" = "X" ]; then
8 fatal '$TEST_COMBASE is not set'
9fi
10
11VERSIONS="
12 2.0.12
13 2.0.13
14 2.1.0
15 2.2.0
16 2.3.0
17 2.3.1
18 2.4.0
19 3.0.0
20 3.1.0"
21# 2.0.10 does not support UserConfigDirectory
22
23SRC=`dirname ${SCRIPT}`
24
25# ssh.com
26cat << EOF > $OBJ/sshd2_config
27*:
28 # Port and ListenAdress are not used.
29 QuietMode yes
30 Port 4343
31 ListenAddress 127.0.0.1
32 UserConfigDirectory ${OBJ}/%U
33 Ciphers AnyCipher
34 PubKeyAuthentication yes
35 #AllowedAuthentications publickey
36 AuthorizationFile authorization
37 HostKeyFile ${SRC}/dsa_ssh2.prv
38 PublicHostKeyFile ${SRC}/dsa_ssh2.pub
39 RandomSeedFile ${OBJ}/random_seed
40 MaxConnections 0
41 PermitRootLogin yes
42 VerboseMode no
43 CheckMail no
44 Ssh1Compatibility no
45EOF
46
47# create client config
48sed "s/HostKeyAlias.*/HostKeyAlias ssh2-localhost-with-alias/" \
49 < $OBJ/ssh_config > $OBJ/ssh_config_com
50
51# we need a DSA key for
52rm -f ${OBJ}/dsa ${OBJ}/dsa.pub
53${SSHKEYGEN} -q -N '' -t dsa -f ${OBJ}/dsa
54
55# setup userdir, try rsa first
56mkdir -p ${OBJ}/${USER}
57cp /dev/null ${OBJ}/${USER}/authorization
58for t in rsa dsa; do
59 ${SSHKEYGEN} -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com
60 echo Key $t.com >> ${OBJ}/${USER}/authorization
61 echo IdentityFile ${OBJ}/$t >> ${OBJ}/ssh_config_com
62done
63
64# convert and append DSA hostkey
65(
66 echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 '
67 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub
68) >> $OBJ/known_hosts
69
70# go for it
71for v in ${VERSIONS}; do
72 sshd2=${TEST_COMBASE}/${v}/sshd2
73 if [ ! -x ${sshd2} ]; then
74 continue
75 fi
76 trace "sshd2 ${v}"
77 PROXY="proxycommand ${sshd2} -qif ${OBJ}/sshd2_config 2> /dev/null"
78 ${SSH} -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
79 if [ $? -ne 0 ]; then
80 fail "ssh connect to sshd2 ${v} failed"
81 fi
82
83 ciphers="3des-cbc blowfish-cbc arcfour"
84 macs="hmac-md5"
85 case $v in
86 2.4.*)
87 ciphers="$ciphers cast128-cbc"
88 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
89 ;;
90 3.*)
91 ciphers="$ciphers aes128-cbc cast128-cbc"
92 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
93 ;;
94 esac
95 #ciphers="3des-cbc"
96 for m in $macs; do
97 for c in $ciphers; do
98 trace "sshd2 ${v} cipher $c mac $m"
99 verbose "test ${tid}: sshd2 ${v} cipher $c mac $m"
100 ${SSH} -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
101 if [ $? -ne 0 ]; then
102 fail "ssh connect to sshd2 ${v} with $c/$m failed"
103 fi
104 done
105 done
106done
107
108rm -rf ${OBJ}/${USER}
109for i in sshd_config_proxy ssh_config_proxy random_seed \
110 sshd2_config dsa.pub dsa ssh_config_com; do
111 rm -f ${OBJ}/$i
112done
diff --git a/regress/stderr-after-eof.sh b/regress/stderr-after-eof.sh
new file mode 100644
index 000000000..bebd700bf
--- /dev/null
+++ b/regress/stderr-after-eof.sh
@@ -0,0 +1,30 @@
1# $OpenBSD: stderr-after-eof.sh,v 1.1 2002/03/23 16:38:09 markus Exp $
2# Placed in the Public Domain.
3
4tid="stderr data after eof"
5
6DATA=/etc/motd
7DATA=${OBJ}/data
8COPY=${OBJ}/copy
9
10MD5=md5sum
11
12# setup data
13rm -f ${DATA} ${COPY}
14cp /dev/null ${DATA}
15for i in 1 2 3 4 5 6; do
16 (date;echo $i) | $MD5 >> ${DATA}
17done
18
19${SSH} -2 -F $OBJ/ssh_proxy otherhost \
20 exec sh -c \'"exec > /dev/null; sleep 2; cat ${DATA} 1>&2 $s"\' \
21 2> ${COPY}
22r=$?
23if [ $r -ne 0 ]; then
24 fail "ssh failed with exit code $r"
25fi
26egrep 'Disconnecting: Received extended_data after EOF' ${COPY} &&
27 fail "ext data received after eof"
28cmp ${DATA} ${COPY} || fail "stderr corrupt"
29
30rm -f ${DATA} ${COPY}
diff --git a/regress/stderr-data.sh b/regress/stderr-data.sh
new file mode 100644
index 000000000..0157690b0
--- /dev/null
+++ b/regress/stderr-data.sh
@@ -0,0 +1,33 @@
1# $OpenBSD: stderr-data.sh,v 1.2 2002/03/27 22:39:52 markus Exp $
2# Placed in the Public Domain.
3
4tid="stderr data transfer"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8rm -f ${COPY}
9
10for n in '' -n; do
11for p in 1 2; do
12 verbose "test $tid: proto $p ($n)"
13 ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
14 exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
15 2> ${COPY}
16 r=$?
17 if [ $r -ne 0 ]; then
18 fail "ssh failed with exit code $r"
19 fi
20 cmp ${DATA} ${COPY} || fail "stderr corrupt"
21 rm -f ${COPY}
22
23 ${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
24 exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
25 > /dev/null 2> ${COPY}
26 r=$?
27 if [ $r -ne 0 ]; then
28 fail "ssh failed with exit code $r"
29 fi
30 cmp ${DATA} ${COPY} || fail "stderr corrupt"
31 rm -f ${COPY}
32done
33done
diff --git a/regress/t4.ok b/regress/t4.ok
new file mode 100644
index 000000000..8c4942bf1
--- /dev/null
+++ b/regress/t4.ok
@@ -0,0 +1 @@
3b:dd:44:e9:49:18:84:95:f1:e7:33:6b:9d:93:b1:36
diff --git a/regress/t5.ok b/regress/t5.ok
new file mode 100644
index 000000000..bd622f300
--- /dev/null
+++ b/regress/t5.ok
@@ -0,0 +1 @@
xokes-lylis-byleh-zebib-kalus-bihas-tevah-haroz-suhar-foved-noxex
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
new file mode 100644
index 000000000..a7a8ddbe6
--- /dev/null
+++ b/regress/test-exec.sh
@@ -0,0 +1,224 @@
1# $OpenBSD: test-exec.sh,v 1.14 2002/04/15 15:19:48 markus Exp $
2# Placed in the Public Domain.
3
4PORT=4242
5USER=`id -un`
6SUDO=
7#SUDO=sudo
8
9OBJ=$1
10if [ "x$OBJ" = "x" ]; then
11 echo '$OBJ not defined'
12 exit 2
13fi
14if [ ! -d $OBJ ]; then
15 echo "not a directory: $OBJ"
16 exit 2
17fi
18SCRIPT=$2
19if [ "x$SCRIPT" = "x" ]; then
20 echo '$SCRIPT not defined'
21 exit 2
22fi
23if [ ! -f $SCRIPT ]; then
24 echo "not a file: $SCRIPT"
25 exit 2
26fi
27if sh -n $SCRIPT; then
28 true
29else
30 echo "syntax error in $SCRIPT"
31 exit 2
32fi
33unset SSH_AUTH_SOCK
34
35# defaults
36SSH=ssh
37SSHD=sshd
38SSHAGENT=ssh-agent
39SSHADD=ssh-add
40SSHKEYGEN=ssh-keygen
41SSHKEYSCAN=ssh-keyscan
42SFTP=sftp
43SFTPSERVER=/usr/libexec/openssh/sftp-server
44
45if [ "x$TEST_SSH_SSH" != "x" ]; then
46 SSH=${TEST_SSH_SSH}
47fi
48if [ "x$TEST_SSH_SSHD" != "x" ]; then
49 SSHD=${TEST_SSH_SSHD}
50fi
51if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then
52 SSHAGENT=${TEST_SSH_SSHAGENT}
53fi
54if [ "x$TEST_SSH_SSHADD" != "x" ]; then
55 SSHADD=${TEST_SSH_SSHADD}
56fi
57if [ "x$TEST_SSH_SSHKEYGEN" != "x" ]; then
58 SSHKEYGEN=${TEST_SSH_SSHKEYGEN}
59fi
60if [ "x$TEST_SSH_SSHKEYSCAN" != "x" ]; then
61 SSHKEYSCAN=${TEST_SSH_SSHKEYSCAN}
62fi
63if [ "x$TEST_SSH_SFTP" != "x" ]; then
64 SFTP=${TEST_SSH_SFTP}
65fi
66if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then
67 SFTPSERVER=${TEST_SSH_SFTPSERVER}
68fi
69
70# these should be used in tests
71export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER
72#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER
73
74# helper
75cleanup ()
76{
77 if [ -f $PIDFILE ]; then
78 pid=`cat $PIDFILE`
79 if [ "X$pid" = "X" ]; then
80 echo no sshd running
81 else
82 if [ $pid -lt 2 ]; then
83 echo bad pid for ssd: $pid
84 else
85 $SUDO kill $pid
86 fi
87 fi
88 fi
89}
90
91trace ()
92{
93 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
94 echo "$@"
95 fi
96}
97
98verbose ()
99{
100 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
101 echo "$@"
102 fi
103}
104
105
106fail ()
107{
108 RESULT=1
109 echo "$@"
110}
111
112fatal ()
113{
114 echo -n "FATAL: "
115 fail "$@"
116 cleanup
117 exit $RESULT
118}
119
120RESULT=0
121PIDFILE=$OBJ/pidfile
122
123trap fatal 3 2
124
125# create server config
126cat << EOF > $OBJ/sshd_config
127 Port $PORT
128 ListenAddress 127.0.0.1
129 #ListenAddress ::1
130 PidFile $PIDFILE
131 AuthorizedKeysFile $OBJ/authorized_keys_%u
132 LogLevel QUIET
133EOF
134
135# server config for proxy connects
136cp $OBJ/sshd_config $OBJ/sshd_proxy
137
138# allow group-writable directories in proxy-mode
139echo 'StrictModes no' >> $OBJ/sshd_proxy
140
141# create client config
142cat << EOF > $OBJ/ssh_config
143Host *
144 Hostname 127.0.0.1
145 HostKeyAlias localhost-with-alias
146 Port $PORT
147 User $USER
148 GlobalKnownHostsFile $OBJ/known_hosts
149 UserKnownHostsFile $OBJ/known_hosts
150 RSAAuthentication yes
151 PubkeyAuthentication yes
152 ChallengeResponseAuthentication no
153 HostbasedAuthentication no
154 PasswordAuthentication no
155 RhostsAuthentication no
156 RhostsRSAAuthentication no
157 BatchMode yes
158 StrictHostKeyChecking yes
159EOF
160
161rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
162
163trace "generate keys"
164for t in rsa rsa1; do
165 # generate user key
166 rm -f $OBJ/$t
167 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
168 fail "ssh-keygen for $t failed"
169
170 # known hosts file for client
171 (
172 echo -n 'localhost-with-alias,127.0.0.1,::1 '
173 cat $OBJ/$t.pub
174 ) >> $OBJ/known_hosts
175
176 # setup authorized keys
177 cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
178 echo IdentityFile $OBJ/$t >> $OBJ/ssh_config
179
180 # use key as host key, too
181 $SUDO cp $OBJ/$t $OBJ/host.$t
182 echo HostKey $OBJ/host.$t >> $OBJ/sshd_config
183
184 # don't use SUDO for proxy connect
185 echo HostKey $OBJ/$t >> $OBJ/sshd_proxy
186done
187chmod 644 $OBJ/authorized_keys_$USER
188
189# create a proxy version of the client config
190(
191 cat $OBJ/ssh_config
192 echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy
193) > $OBJ/ssh_proxy
194
195# check proxy config
196${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken"
197
198start_sshd ()
199{
200 # start sshd
201 $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken"
202 $SUDO ${SSHD} -f $OBJ/sshd_config
203
204 trace "wait for sshd"
205 i=0;
206 while [ ! -f $PIDFILE -a $i -lt 5 ]; do
207 i=`expr $i + 1`
208 sleep $i
209 done
210
211 test -f $PIDFILE || fatal "no sshd running on port $PORT"
212}
213
214# source test body
215. $SCRIPT
216
217# kill sshd
218cleanup
219if [ $RESULT -eq 0 ]; then
220 verbose ok $tid
221else
222 echo failed $tid
223fi
224exit $RESULT
diff --git a/regress/transfer.sh b/regress/transfer.sh
new file mode 100644
index 000000000..31cdc0ce3
--- /dev/null
+++ b/regress/transfer.sh
@@ -0,0 +1,29 @@
1# $OpenBSD: transfer.sh,v 1.1 2002/03/27 00:03:37 markus Exp $
2# Placed in the Public Domain.
3
4tid="transfer data"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9for p in 1 2; do
10 verbose "$tid: proto $p"
11 rm -f ${COPY}
12 ${SSH} -n -q -$p -F $OBJ/ssh_proxy somehost cat ${DATA} > ${COPY}
13 if [ $? -ne 0 ]; then
14 fail "ssh cat $DATA failed"
15 fi
16 cmp ${DATA} ${COPY} || fail "corrupted copy"
17
18 for s in 10 100 1k 32k 64k 128k 256k; do
19 trace "proto $p dd-size ${s}"
20 rm -f ${COPY}
21 dd if=$DATA obs=${s} 2> /dev/null | \
22 ${SSH} -q -$p -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
23 if [ $? -ne 0 ]; then
24 fail "ssh cat $DATA failed"
25 fi
26 cmp $DATA ${COPY} || fail "corrupted copy"
27 done
28done
29rm -f ${COPY}
diff --git a/regress/try-ciphers.sh b/regress/try-ciphers.sh
new file mode 100644
index 000000000..161f039c0
--- /dev/null
+++ b/regress/try-ciphers.sh
@@ -0,0 +1,29 @@
1# $OpenBSD: try-ciphers.sh,v 1.7 2002/04/03 09:30:01 markus Exp $
2# Placed in the Public Domain.
3
4tid="try ciphers"
5
6ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour
7 aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se"
8macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96"
9
10for c in $ciphers; do
11 for m in $macs; do
12 trace "proto 2 cipher $c mac $m"
13 verbose "test $tid: proto 2 cipher $c mac $m"
14 ${SSH} -F $OBJ/ssh_proxy -2 -m $m -c $c somehost true
15 if [ $? -ne 0 ]; then
16 fail "ssh -2 failed with mac $m cipher $c"
17 fi
18 done
19done
20
21ciphers="3des blowfish"
22for c in $ciphers; do
23 trace "proto 1 cipher $c"
24 verbose "test $tid: proto 1 cipher $c"
25 ${SSH} -F $OBJ/ssh_proxy -1 -c $c somehost true
26 if [ $? -ne 0 ]; then
27 fail "ssh -1 failed with cipher $c"
28 fi
29done
diff --git a/regress/yes-head.sh b/regress/yes-head.sh
new file mode 100644
index 000000000..f213f6863
--- /dev/null
+++ b/regress/yes-head.sh
@@ -0,0 +1,15 @@
1# $OpenBSD: yes-head.sh,v 1.4 2002/03/15 13:08:56 markus Exp $
2# Placed in the Public Domain.
3
4tid="yes pipe head"
5
6for p in 1 2; do
7 lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'yes | head -2000' | (sleep 3 ; wc -l)`
8 if [ $? -ne 0 ]; then
9 fail "yes|head test failed"
10 lines = 0;
11 fi
12 if [ $lines -ne 2000 ]; then
13 fail "yes|head returns $lines lines instead of 2000"
14 fi
15done