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