1 # $OpenBSD: keytype.sh,v 1.1 2010/09/02 16:12:55 markus Exp $ 2 # Placed in the Public Domain. 3 4 tid="login with different key types" 5 6 TIME=`which time` 2>/dev/null 7 if test ! -x "$TIME"; then 8 TIME="" 9 fi 10 11 cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 12 cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak 13 14 ktypes="dsa-1024 rsa-2048 rsa-3072" 15 if test "$TEST_SSH_ECC" = "yes"; then 16 ktypes="$ktypes ecdsa-256 ecdsa-384 ecdsa-521" 17 fi 18 19 for kt in $ktypes; do 20 rm -f $OBJ/key.$kt 21 bits=`echo ${kt} | awk -F- '{print $2}'` 22 type=`echo ${kt} | awk -F- '{print $1}'` 23 printf "keygen $type, $bits bits:\t" 24 ${TIME} ${SSHKEYGEN} -b $bits -q -N '' -t $type -f $OBJ/key.$kt ||\ 25 fail "ssh-keygen for type $type, $bits bits failed" 26 done 27 28 tries="1 2 3" 29 for ut in $ktypes; do 30 htypes=$ut 31 #htypes=$ktypes 32 for ht in $htypes; do 33 trace "ssh connect, userkey $ut, hostkey $ht" 34 ( 35 grep -v HostKey $OBJ/sshd_proxy_bak 36 echo HostKey $OBJ/key.$ht 37 ) > $OBJ/sshd_proxy 38 ( 39 grep -v IdentityFile $OBJ/ssh_proxy_bak 40 echo IdentityFile $OBJ/key.$ut 41 ) > $OBJ/ssh_proxy 42 ( 43 echon 'localhost-with-alias,127.0.0.1,::1 ' 44 cat $OBJ/key.$ht.pub 45 ) > $OBJ/known_hosts 46 cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER 47 for i in $tries; do 48 printf "userkey $ut, hostkey ${ht}:\t" 49 ${TIME} ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true 50 if [ $? -ne 0 ]; then 51 fail "ssh userkey $ut, hostkey $ht failed" 52 fi 53 done 54 done 55 done 56