blob: c2bd15380754364886c224160835b1729f39e94f [file] [log] [blame]
Damien Miller8b9cde72003-01-22 17:53:16 +11001# $OpenBSD: ssh-com.sh,v 1.4 2002/07/16 08:58:16 markus Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# 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
Damien Miller38cd4352002-05-01 13:17:33 +100017 2.4.0
18 3.0.0
Damien Miller8b9cde72003-01-22 17:53:16 +110019 3.1.0
20 3.2.0
21 3.3.0"
Damien Miller38cd4352002-05-01 13:17:33 +100022# 2.0.10 does not support UserConfigDirectory
Damien Miller8b9cde72003-01-22 17:53:16 +110023# 2.3.1 requires a config in $HOME/.ssh2
Damien Miller38cd4352002-05-01 13:17:33 +100024
25SRC=`dirname ${SCRIPT}`
26
27# ssh.com
28cat << EOF > $OBJ/sshd2_config
Damien Miller8b9cde72003-01-22 17:53:16 +110029#*:
Damien Miller38cd4352002-05-01 13:17:33 +100030 # Port and ListenAdress are not used.
31 QuietMode yes
32 Port 4343
33 ListenAddress 127.0.0.1
34 UserConfigDirectory ${OBJ}/%U
35 Ciphers AnyCipher
36 PubKeyAuthentication yes
37 #AllowedAuthentications publickey
38 AuthorizationFile authorization
39 HostKeyFile ${SRC}/dsa_ssh2.prv
40 PublicHostKeyFile ${SRC}/dsa_ssh2.pub
41 RandomSeedFile ${OBJ}/random_seed
42 MaxConnections 0
43 PermitRootLogin yes
44 VerboseMode no
45 CheckMail no
46 Ssh1Compatibility no
47EOF
48
49# create client config
50sed "s/HostKeyAlias.*/HostKeyAlias ssh2-localhost-with-alias/" \
51 < $OBJ/ssh_config > $OBJ/ssh_config_com
52
53# we need a DSA key for
54rm -f ${OBJ}/dsa ${OBJ}/dsa.pub
55${SSHKEYGEN} -q -N '' -t dsa -f ${OBJ}/dsa
56
57# setup userdir, try rsa first
58mkdir -p ${OBJ}/${USER}
59cp /dev/null ${OBJ}/${USER}/authorization
60for t in rsa dsa; do
61 ${SSHKEYGEN} -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com
62 echo Key $t.com >> ${OBJ}/${USER}/authorization
63 echo IdentityFile ${OBJ}/$t >> ${OBJ}/ssh_config_com
64done
65
66# convert and append DSA hostkey
67(
68 echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 '
69 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub
70) >> $OBJ/known_hosts
71
72# go for it
73for v in ${VERSIONS}; do
74 sshd2=${TEST_COMBASE}/${v}/sshd2
75 if [ ! -x ${sshd2} ]; then
76 continue
77 fi
78 trace "sshd2 ${v}"
79 PROXY="proxycommand ${sshd2} -qif ${OBJ}/sshd2_config 2> /dev/null"
80 ${SSH} -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
81 if [ $? -ne 0 ]; then
82 fail "ssh connect to sshd2 ${v} failed"
83 fi
84
85 ciphers="3des-cbc blowfish-cbc arcfour"
86 macs="hmac-md5"
87 case $v in
88 2.4.*)
89 ciphers="$ciphers cast128-cbc"
90 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
91 ;;
92 3.*)
93 ciphers="$ciphers aes128-cbc cast128-cbc"
94 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
95 ;;
96 esac
97 #ciphers="3des-cbc"
98 for m in $macs; do
99 for c in $ciphers; do
100 trace "sshd2 ${v} cipher $c mac $m"
101 verbose "test ${tid}: sshd2 ${v} cipher $c mac $m"
102 ${SSH} -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
103 if [ $? -ne 0 ]; then
104 fail "ssh connect to sshd2 ${v} with $c/$m failed"
105 fi
106 done
107 done
108done
109
110rm -rf ${OBJ}/${USER}
111for i in sshd_config_proxy ssh_config_proxy random_seed \
112 sshd2_config dsa.pub dsa ssh_config_com; do
113 rm -f ${OBJ}/$i
114done