diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/Makefile | 18 | ||||
-rw-r--r-- | regress/putty-ciphers.sh | 30 | ||||
-rw-r--r-- | regress/putty-kex.sh | 27 | ||||
-rw-r--r-- | regress/putty-transfer.sh | 45 | ||||
-rwxr-xr-x | regress/ssh2putty.sh | 31 | ||||
-rw-r--r-- | regress/test-exec.sh | 44 |
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 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
5 | 5 | ||
6 | # Interop tests are not run by default | ||
7 | interop: t-exec-interop | ||
8 | |||
6 | clean: | 9 | clean: |
7 | for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done | 10 | for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done |
8 | distclean: clean | 11 | distclean: clean |
@@ -45,6 +48,9 @@ LTESTS= connect \ | |||
45 | localcommand \ | 48 | localcommand \ |
46 | forcecommand | 49 | forcecommand |
47 | 50 | ||
51 | INTEROP_TESTS= putty-transfer putty-ciphers putty-kex | ||
52 | #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp | ||
53 | |||
48 | USER!= id -un | 54 | USER!= id -un |
49 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | 55 | CLEANFILES= 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 | |||
60 | t1: | 64 | t1: |
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 | |||
105 | t-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 | |||
4 | tid="putty ciphers" | ||
5 | |||
6 | DATA=/bin/ls | ||
7 | COPY=${OBJ}/copy | ||
8 | |||
9 | set -e | ||
10 | |||
11 | if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then | ||
12 | fatal "putty interop tests not enabled" | ||
13 | fi | ||
14 | |||
15 | for 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" | ||
28 | done | ||
29 | rm -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 | |||
4 | tid="putty KEX" | ||
5 | |||
6 | DATA=/bin/ls | ||
7 | COPY=${OBJ}/copy | ||
8 | |||
9 | set -e | ||
10 | |||
11 | if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then | ||
12 | fatal "putty interop tests not enabled" | ||
13 | fi | ||
14 | |||
15 | for 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 | ||
26 | done | ||
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 | |||
4 | tid="putty transfer data" | ||
5 | |||
6 | DATA=/bin/ls | ||
7 | COPY=${OBJ}/copy | ||
8 | |||
9 | set -e | ||
10 | |||
11 | if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then | ||
12 | fatal "putty interop tests not enabled" | ||
13 | fi | ||
14 | |||
15 | # XXX support protocol 1 too | ||
16 | for 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 | ||
43 | done | ||
44 | rm -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 | |||
3 | if 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 | ||
6 | fi | ||
7 | |||
8 | HOST=$1 | ||
9 | PORT=$2 | ||
10 | KEYFILE=$3 | ||
11 | |||
12 | # XXX - support DSA keys too | ||
13 | if ! grep -q "BEGIN RSA PRIVATE KEY" $KEYFILE ; then | ||
14 | echo "Unsupported private key format" | ||
15 | exit 1 | ||
16 | fi | ||
17 | |||
18 | public_exponent=` | ||
19 | openssl rsa -noout -text -in $KEYFILE | grep ^publicExponent | | ||
20 | sed 's/.*(//;s/).*//' | ||
21 | ` | ||
22 | test $? -ne 0 && exit 1 | ||
23 | |||
24 | modulus=` | ||
25 | openssl rsa -noout -modulus -in $KEYFILE | grep ^Modulus= | | ||
26 | sed 's/^Modulus=/0x/' | tr A-Z a-z | ||
27 | ` | ||
28 | test $? -ne 0 && exit 1 | ||
29 | |||
30 | echo "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 | |||
69 | SFTPSERVER=/usr/libexec/openssh/sftp-server | 69 | SFTPSERVER=/usr/libexec/openssh/sftp-server |
70 | SCP=scp | 70 | SCP=scp |
71 | 71 | ||
72 | # Interop testing | ||
73 | PLINK=/usr/local/bin/plink | ||
74 | PUTTYGEN=/usr/local/bin/puttygen | ||
75 | |||
72 | if [ "x$TEST_SSH_SSH" != "x" ]; then | 76 | if [ "x$TEST_SSH_SSH" != "x" ]; then |
73 | SSH="${TEST_SSH_SSH}" | 77 | SSH="${TEST_SSH_SSH}" |
74 | fi | 78 | fi |
@@ -96,6 +100,12 @@ fi | |||
96 | if [ "x$TEST_SSH_SCP" != "x" ]; then | 100 | if [ "x$TEST_SSH_SCP" != "x" ]; then |
97 | SCP="${TEST_SSH_SCP}" | 101 | SCP="${TEST_SSH_SCP}" |
98 | fi | 102 | fi |
103 | if [ "x$TEST_SSH_PLINK" != "x" ]; then | ||
104 | PLINK="${TEST_SSH_PLINK}" | ||
105 | fi | ||
106 | if [ "x$TEST_SSH_PUTTYGEN" != "x" ]; then | ||
107 | PUTTYGEN="${TEST_SSH_PUTTYGEN}" | ||
108 | fi | ||
99 | 109 | ||
100 | # Path to sshd must be absolute for rexec | 110 | # Path to sshd must be absolute for rexec |
101 | case "$SSHD" in | 111 | case "$SSHD" in |
@@ -269,6 +279,34 @@ for t in rsa rsa1; do | |||
269 | done | 279 | done |
270 | chmod 644 $OBJ/authorized_keys_$USER | 280 | chmod 644 $OBJ/authorized_keys_$USER |
271 | 281 | ||
282 | # If PuTTY is present, prepare keys and configuration | ||
283 | REGRESS_INTEROP_PUTTY=no | ||
284 | if 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 | ||
308 | fi | ||
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" | |||
281 | start_sshd () | 319 | start_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; |