summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile18
-rw-r--r--regress/putty-ciphers.sh30
-rw-r--r--regress/putty-kex.sh27
-rw-r--r--regress/putty-transfer.sh45
-rwxr-xr-xregress/ssh2putty.sh31
-rw-r--r--regress/test-exec.sh44
6 files changed, 189 insertions, 6 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 196020db8..7b571f7ec 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,8 +1,11 @@
1# $OpenBSD: Makefile,v 1.43 2007/10/29 06:57:13 dtucker Exp $ 1# $OpenBSD: Makefile,v 1.44 2007/12/21 04:13:53 djm Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(REGRESS_TARGETS)
5 5
6# Interop tests are not run by default
7interop: t-exec-interop
8
6clean: 9clean:
7 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done 10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
8distclean: clean 11distclean: clean
@@ -45,6 +48,9 @@ LTESTS= connect \
45 localcommand \ 48 localcommand \
46 forcecommand 49 forcecommand
47 50
51INTEROP_TESTS= putty-transfer putty-ciphers putty-kex
52#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
53
48USER!= id -un 54USER!= id -un
49CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ 55CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
50 authorized_keys_${USER} known_hosts pidfile \ 56 authorized_keys_${USER} known_hosts pidfile \
@@ -55,8 +61,6 @@ CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
55 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \ 61 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
56 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv 62 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv
57 63
58#LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
59
60t1: 64t1:
61 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv 65 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
62 66
@@ -97,3 +101,11 @@ t-exec: ${LTESTS:=.sh}
97 echo "run test $${TEST}" ... 1>&2; \ 101 echo "run test $${TEST}" ... 1>&2; \
98 (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ 102 (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
99 done 103 done
104
105t-exec-interop: ${INTEROP_TESTS:=.sh}
106 @if [ "x$?" = "x" ]; then exit 0; fi; \
107 for TEST in ""$?; do \
108 echo "run test $${TEST}" ... 1>&2; \
109 (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
110 done
111
diff --git a/regress/putty-ciphers.sh b/regress/putty-ciphers.sh
new file mode 100644
index 000000000..e9196d621
--- /dev/null
+++ b/regress/putty-ciphers.sh
@@ -0,0 +1,30 @@
1# $OpenBSD: putty-ciphers.sh,v 1.1 2007/12/21 04:13:53 djm Exp $
2# Placed in the Public Domain.
3
4tid="putty ciphers"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9set -e
10
11if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
12 fatal "putty interop tests not enabled"
13fi
14
15for c in aes blowfish 3des arcfour ; do
16 verbose "$tid: cipher $c"
17 cp ${OBJ}/.putty/sessions/localhost_proxy \
18 ${OBJ}/.putty/sessions/cipher_$c
19 echo "Cipher=$c" >> ${OBJ}/.putty/sessions/cipher_$c
20
21 rm -f ${COPY}
22 env HOME=$PWD ${PLINK} -load cipher_$c -batch -i putty.rsa2 \
23 127.0.0.1 cat ${DATA} > ${COPY}
24 if [ $? -ne 0 ]; then
25 fail "ssh cat $DATA failed"
26 fi
27 cmp ${DATA} ${COPY} || fail "corrupted copy"
28done
29rm -f ${COPY}
30
diff --git a/regress/putty-kex.sh b/regress/putty-kex.sh
new file mode 100644
index 000000000..d0437c6d5
--- /dev/null
+++ b/regress/putty-kex.sh
@@ -0,0 +1,27 @@
1# $OpenBSD: putty-kex.sh,v 1.1 2007/12/21 04:13:53 djm Exp $
2# Placed in the Public Domain.
3
4tid="putty KEX"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9set -e
10
11if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
12 fatal "putty interop tests not enabled"
13fi
14
15for k in dh-gex-sha1 dh-group1-sha1 dh-group14-sha1 ; do
16 verbose "$tid: kex $k"
17 cp ${OBJ}/.putty/sessions/localhost_proxy \
18 ${OBJ}/.putty/sessions/kex_$k
19 echo "KEX=$k" >> ${OBJ}/.putty/sessions/kex_$k
20
21 env HOME=$PWD ${PLINK} -load kex_$k -batch -i putty.rsa2 \
22 127.0.0.1 true
23 if [ $? -ne 0 ]; then
24 fail "KEX $k failed"
25 fi
26done
27
diff --git a/regress/putty-transfer.sh b/regress/putty-transfer.sh
new file mode 100644
index 000000000..0a4f34ee6
--- /dev/null
+++ b/regress/putty-transfer.sh
@@ -0,0 +1,45 @@
1# $OpenBSD: putty-transfer.sh,v 1.1 2007/12/21 04:13:53 djm Exp $
2# Placed in the Public Domain.
3
4tid="putty transfer data"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9set -e
10
11if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
12 fatal "putty interop tests not enabled"
13fi
14
15# XXX support protocol 1 too
16for p in 2; do
17 for c in 0 1 ; do
18 verbose "$tid: proto $p compression $c"
19 rm -f ${COPY}
20 cp ${OBJ}/.putty/sessions/localhost_proxy \
21 ${OBJ}/.putty/sessions/compression_$c
22 echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k
23 env HOME=$PWD ${PLINK} -load compression_$c -batch \
24 -i putty.rsa$p 127.0.0.1 cat ${DATA} > ${COPY}
25 if [ $? -ne 0 ]; then
26 fail "ssh cat $DATA failed"
27 fi
28 cmp ${DATA} ${COPY} || fail "corrupted copy"
29
30 for s in 10 100 1k 32k 64k 128k 256k; do
31 trace "proto $p compression $c dd-size ${s}"
32 rm -f ${COPY}
33 dd if=$DATA obs=${s} 2> /dev/null | \
34 env HOME=$PWD ${PLINK} -load compression_$c \
35 -batch -i putty.rsa$p 127.0.0.1 \
36 "cat > ${COPY}"
37 if [ $? -ne 0 ]; then
38 fail "ssh cat $DATA failed"
39 fi
40 cmp $DATA ${COPY} || fail "corrupted copy"
41 done
42 done
43done
44rm -f ${COPY}
45
diff --git a/regress/ssh2putty.sh b/regress/ssh2putty.sh
new file mode 100755
index 000000000..82dd44787
--- /dev/null
+++ b/regress/ssh2putty.sh
@@ -0,0 +1,31 @@
1#!/bin/sh
2
3if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then
4 echo "Usage: ssh2putty hostname port ssh-private-key"
5 exit 1
6fi
7
8HOST=$1
9PORT=$2
10KEYFILE=$3
11
12# XXX - support DSA keys too
13if ! grep -q "BEGIN RSA PRIVATE KEY" $KEYFILE ; then
14 echo "Unsupported private key format"
15 exit 1
16fi
17
18public_exponent=`
19 openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent |
20 sed 's/.*(//;s/).*//'
21`
22test $? -ne 0 && exit 1
23
24modulus=`
25 openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= |
26 sed 's/^Modulus=/0x/' | tr A-Z a-z
27`
28test $? -ne 0 && exit 1
29
30echo "rsa2@$PORT:$HOST $public_exponent,$modulus"
31
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index e44778065..1eb9ff729 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.30 2007/10/26 05:30:01 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.31 2007/12/21 04:13:53 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -69,6 +69,10 @@ SFTP=sftp
69SFTPSERVER=/usr/libexec/openssh/sftp-server 69SFTPSERVER=/usr/libexec/openssh/sftp-server
70SCP=scp 70SCP=scp
71 71
72# Interop testing
73PLINK=/usr/local/bin/plink
74PUTTYGEN=/usr/local/bin/puttygen
75
72if [ "x$TEST_SSH_SSH" != "x" ]; then 76if [ "x$TEST_SSH_SSH" != "x" ]; then
73 SSH="${TEST_SSH_SSH}" 77 SSH="${TEST_SSH_SSH}"
74fi 78fi
@@ -96,6 +100,12 @@ fi
96if [ "x$TEST_SSH_SCP" != "x" ]; then 100if [ "x$TEST_SSH_SCP" != "x" ]; then
97 SCP="${TEST_SSH_SCP}" 101 SCP="${TEST_SSH_SCP}"
98fi 102fi
103if [ "x$TEST_SSH_PLINK" != "x" ]; then
104 PLINK="${TEST_SSH_PLINK}"
105fi
106if [ "x$TEST_SSH_PUTTYGEN" != "x" ]; then
107 PUTTYGEN="${TEST_SSH_PUTTYGEN}"
108fi
99 109
100# Path to sshd must be absolute for rexec 110# Path to sshd must be absolute for rexec
101case "$SSHD" in 111case "$SSHD" in
@@ -269,6 +279,34 @@ for t in rsa rsa1; do
269done 279done
270chmod 644 $OBJ/authorized_keys_$USER 280chmod 644 $OBJ/authorized_keys_$USER
271 281
282# If PuTTY is present, prepare keys and configuration
283REGRESS_INTEROP_PUTTY=no
284if test -x $PUTTYGEN -a -x $PLINK ; then
285 mkdir -p ${OBJ}/.putty
286
287 # Add a PuTTY key to authorized_keys
288 rm -f ${OBJ}/putty.rsa2
289 puttygen -t rsa -o ${OBJ}/putty.rsa2 < /dev/null > /dev/null
290 puttygen -O public-openssh ${OBJ}/putty.rsa2 \
291 >> $OBJ/authorized_keys_$USER
292
293 # Convert rsa2 host key to PuTTY format
294 ${SRC}/ssh2putty.sh 127.0.0.1 $PORT $OBJ/rsa > \
295 ${OBJ}/.putty/sshhostkeys
296 ${SRC}/ssh2putty.sh 127.0.0.1 22 $OBJ/rsa >> \
297 ${OBJ}/.putty/sshhostkeys
298
299 # Setup proxied session
300 mkdir -p ${OBJ}/.putty/sessions
301 rm -f ${OBJ}/.putty/sessions/localhost_proxy
302 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
303 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
304 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
305 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
306
307 REGRESS_INTEROP_PUTTY=yes
308fi
309
272# create a proxy version of the client config 310# create a proxy version of the client config
273( 311(
274 cat $OBJ/ssh_config 312 cat $OBJ/ssh_config
@@ -281,8 +319,8 @@ ${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken"
281start_sshd () 319start_sshd ()
282{ 320{
283 # start sshd 321 # start sshd
284 $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" 322 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken"
285 $SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1 323 $SUDO ${SSHD} -f $OBJ/sshd_config -e "$@" >>$TEST_SSH_LOGFILE 2>&1
286 324
287 trace "wait for sshd" 325 trace "wait for sshd"
288 i=0; 326 i=0;