From 59fa2ffe87b7d58138f5014ed43fd83b0f293d33 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 5 Nov 2010 07:19:15 +0000 Subject: [PATCH] - (dtucker) [regress/keytype.sh] Import new test. --- ChangeLog | 1 + regress/keytype.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 regress/keytype.sh diff --git a/ChangeLog b/ChangeLog index 65e0f9e3..2f309739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,7 @@ non-LOGIN_CAP case into platform.c. - (dtucker) [platform.c platform.h session.c] Move the Cygwin special-case check into platform.c + - (dtucker) [regress/keytype.sh] Import new test. 20101025 - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with diff --git a/regress/keytype.sh b/regress/keytype.sh new file mode 100644 index 00000000..7be3cc0c --- /dev/null +++ b/regress/keytype.sh @@ -0,0 +1,48 @@ +# $OpenBSD: keytype.sh,v 1.1 2010/09/02 16:12:55 markus Exp $ +# Placed in the Public Domain. + +tid="login with different key types" + +TIME=/usr/bin/time +cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak +cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak + +ktypes="dsa-1024 rsa-2048 ecdsa-256 rsa-3072 ecdsa-384 ecdsa-521" + +for kt in $ktypes; do + rm -f $OBJ/key.$kt + bits=${kt#*-} + type=${kt%-*} + printf "keygen $type, $bits bits:\t" + ${TIME} ${SSHKEYGEN} -b $bits -q -N '' -t $type -f $OBJ/key.$kt ||\ + fail "ssh-keygen for type $type, $bits bits failed" +done + +tries="1 2 3" +for ut in $ktypes; do + htypes=$ut + #htypes=$ktypes + for ht in $htypes; do + trace "ssh connect, userkey $ut, hostkey $ht" + ( + grep -v HostKey $OBJ/sshd_proxy_bak + echo HostKey $OBJ/key.$ht + ) > $OBJ/sshd_proxy + ( + grep -v IdentityFile $OBJ/ssh_proxy_bak + echo IdentityFile $OBJ/key.$ut + ) > $OBJ/ssh_proxy + ( + echo -n 'localhost-with-alias,127.0.0.1,::1 ' + cat $OBJ/key.$ht.pub + ) > $OBJ/known_hosts + cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER + for i in $tries; do + printf "userkey $ut, hostkey ${ht}:\t" + ${TIME} ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true + if [ $? -ne 0 ]; then + fail "ssh userkey $ut, hostkey $ht failed" + fi + done + done +done -- 2.11.4.GIT