blob: b1a2505d11351c2100db7ba98bd27bfce02d7670 [file] [log] [blame]
djm@openbsd.orgeffaf522017-05-08 01:52:49 +00001# $OpenBSD: ssh-com.sh,v 1.10 2017/05/08 01:52:49 djm 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
Darren Tuckeree5f83d2003-06-18 22:36:48 +100021 3.2.2
22 3.2.3
Darren Tucker437a5f02004-02-29 20:33:51 +110023 3.2.5
24 3.2.9
25 3.2.9.1
Damien Miller8b9cde72003-01-22 17:53:16 +110026 3.3.0"
Damien Miller38cd4352002-05-01 13:17:33 +100027# 2.0.10 does not support UserConfigDirectory
Damien Miller8b9cde72003-01-22 17:53:16 +110028# 2.3.1 requires a config in $HOME/.ssh2
Damien Miller38cd4352002-05-01 13:17:33 +100029
30SRC=`dirname ${SCRIPT}`
31
32# ssh.com
33cat << EOF > $OBJ/sshd2_config
Damien Miller8b9cde72003-01-22 17:53:16 +110034#*:
Darren Tucker633f3e02004-01-30 13:00:29 +110035 # Port and ListenAddress are not used.
Damien Miller38cd4352002-05-01 13:17:33 +100036 QuietMode yes
37 Port 4343
38 ListenAddress 127.0.0.1
39 UserConfigDirectory ${OBJ}/%U
40 Ciphers AnyCipher
41 PubKeyAuthentication yes
42 #AllowedAuthentications publickey
43 AuthorizationFile authorization
44 HostKeyFile ${SRC}/dsa_ssh2.prv
45 PublicHostKeyFile ${SRC}/dsa_ssh2.pub
46 RandomSeedFile ${OBJ}/random_seed
djm@openbsd.org5ab283d2015-05-08 07:29:00 +000047 MaxConnections 0
Damien Miller38cd4352002-05-01 13:17:33 +100048 PermitRootLogin yes
49 VerboseMode no
50 CheckMail no
51 Ssh1Compatibility no
52EOF
53
djm@openbsd.org5ab283d2015-05-08 07:29:00 +000054# create client config
Damien Miller38cd4352002-05-01 13:17:33 +100055sed "s/HostKeyAlias.*/HostKeyAlias ssh2-localhost-with-alias/" \
56 < $OBJ/ssh_config > $OBJ/ssh_config_com
57
58# we need a DSA key for
59rm -f ${OBJ}/dsa ${OBJ}/dsa.pub
60${SSHKEYGEN} -q -N '' -t dsa -f ${OBJ}/dsa
61
62# setup userdir, try rsa first
63mkdir -p ${OBJ}/${USER}
64cp /dev/null ${OBJ}/${USER}/authorization
65for t in rsa dsa; do
66 ${SSHKEYGEN} -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com
67 echo Key $t.com >> ${OBJ}/${USER}/authorization
68 echo IdentityFile ${OBJ}/$t >> ${OBJ}/ssh_config_com
69done
70
71# convert and append DSA hostkey
72(
Darren Tucker56347ef2013-05-17 13:28:36 +100073 printf 'ssh2-localhost-with-alias,127.0.0.1,::1 '
Damien Miller38cd4352002-05-01 13:17:33 +100074 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub
75) >> $OBJ/known_hosts
76
77# go for it
78for v in ${VERSIONS}; do
79 sshd2=${TEST_COMBASE}/${v}/sshd2
80 if [ ! -x ${sshd2} ]; then
81 continue
82 fi
83 trace "sshd2 ${v}"
84 PROXY="proxycommand ${sshd2} -qif ${OBJ}/sshd2_config 2> /dev/null"
85 ${SSH} -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
86 if [ $? -ne 0 ]; then
87 fail "ssh connect to sshd2 ${v} failed"
88 fi
89
djm@openbsd.orgeffaf522017-05-08 01:52:49 +000090 ciphers="3des-cbc"
Damien Miller38cd4352002-05-01 13:17:33 +100091 macs="hmac-md5"
92 case $v in
93 2.4.*)
94 ciphers="$ciphers cast128-cbc"
95 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
96 ;;
97 3.*)
98 ciphers="$ciphers aes128-cbc cast128-cbc"
99 macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96"
100 ;;
101 esac
102 #ciphers="3des-cbc"
103 for m in $macs; do
104 for c in $ciphers; do
105 trace "sshd2 ${v} cipher $c mac $m"
106 verbose "test ${tid}: sshd2 ${v} cipher $c mac $m"
107 ${SSH} -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0
108 if [ $? -ne 0 ]; then
109 fail "ssh connect to sshd2 ${v} with $c/$m failed"
110 fi
111 done
112 done
113done
114
115rm -rf ${OBJ}/${USER}
116for i in sshd_config_proxy ssh_config_proxy random_seed \
117 sshd2_config dsa.pub dsa ssh_config_com; do
118 rm -f ${OBJ}/$i
119done