1 # $OpenBSD: ssh-com-client.sh,v 1.6 2004/02/24 17:06:52 markus Exp $
2 # Placed in the Public Domain.
4 tid
="connect with ssh.com client"
6 #TEST_COMBASE=/path/to/ssh/com/binaries
7 if [ "X${TEST_COMBASE}" = "X" ]; then
8 fatal
'$TEST_COMBASE is not set'
27 # 2.0.10 2.0.12 2.0.13 don't like the test setup
29 # setup authorized keys
30 SRC
=`dirname ${SCRIPT}`
31 cp ${SRC}/dsa_ssh2.prv
${OBJ}/id.com
32 chmod 600 ${OBJ}/id.com
33 ${SSHKEYGEN} -i -f ${OBJ}/id.com
> $OBJ/id.openssh
34 chmod 600 ${OBJ}/id.openssh
35 ${SSHKEYGEN} -y -f ${OBJ}/id.openssh
> $OBJ/authorized_keys_
$USER
36 ${SSHKEYGEN} -e -f ${OBJ}/id.openssh
> $OBJ/id.com.pub
37 echo IdKey
${OBJ}/id.com
> ${OBJ}/id.list
39 # we need a DSA host key
41 rm -f ${OBJ}/$t ${OBJ}/$t.pub
42 ${SSHKEYGEN} -q -N '' -t $t -f ${OBJ}/$t
43 $SUDO cp $OBJ/$t $OBJ/host.
$t
44 echo HostKey
$OBJ/host.
$t >> $OBJ/sshd_config
46 # add hostkeys to known hosts
47 mkdir
-p ${OBJ}/${USER}/hostkeys
48 HK
=${OBJ}/${USER}/hostkeys/key_${PORT}_127.0
.0.1
49 ${SSHKEYGEN} -e -f ${OBJ}/rsa.pub > ${HK}.ssh-rsa.pub
50 ${SSHKEYGEN} -e -f ${OBJ}/dsa.pub > ${HK}.ssh-dss.pub
52 cat > ${OBJ}/ssh2_config
<< EOF
55 StrictHostKeyChecking yes
59 IdentityFile ${OBJ}/id.list
60 RandomSeedFile ${OBJ}/random_seed
61 UserConfigDirectory ${OBJ}/%U
62 AuthenticationSuccessMsg no
67 # we need a real server (no ProxyConnect option)
75 for v
in ${VERSIONS}; do
76 ssh2
=${TEST_COMBASE}/${v}/ssh2
77 if [ ! -x ${ssh2} ]; then
91 cp ${HK}.
$key.pub
${HK}.pub
94 ${ssh2} -q -F ${OBJ}/ssh2_config somehost
exit 42
96 if [ $r -ne 42 ]; then
97 fail
"ssh2 ${v} exit code test failed (got $r, expected 42)"
102 ${ssh2} -F ${OBJ}/ssh2_config somehost cat ${DATA} > ${COPY}
103 if [ $?
-ne 0 ]; then
104 fail
"ssh2 ${v} cat test (receive) failed"
106 cmp ${DATA} ${COPY} || fail "ssh2 ${v} cat test (receive
) data mismatch
"
108 # data transfer, again
109 if [ $skipcat -eq 0 ]; then
112 ${ssh2} -F ${OBJ}/ssh2_config host "cat > ${COPY}"
113 if [ $?
-ne 0 ]; then
114 fail
"ssh2 ${v} cat test (send) failed"
116 cmp ${DATA} ${COPY} || \
117 fail
"ssh2 ${v} cat test (send) data mismatch"
120 # no stderr after eof
122 ${ssh2} -F ${OBJ}/ssh2_config somehost \
123 exec sh
-c \'"exec > /dev/null; sleep 1; echo bla 1>&2; exit 0"\' \
125 if [ $?
-ne 0 ]; then
126 fail
"ssh2 ${v} stderr test failed"
130 rm -rf ${OBJ}/${USER}
131 for i
in ssh2_config random_seed dsa.pub dsa
host.dsa \
132 id.list id.com id.com.pub id.openssh
; do