summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2010-09-02 16:12:56 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2010-09-02 16:12:56 +0000
commit098ab91d5fa7a29fd958baec2c336bcfc0b37c91 (patch)
tree3778476c493581cd2f12ae1b1b138f622c9e0e2a
parent5ce874838aabadc6e9b617de1d179b18a92b57d5 (diff)
test different key types (dsa, rsa, ecdsa) and sizes for login
and host keys; print time used for each iteration; ok djm@
-rw-r--r--regress/usr.bin/ssh/Makefile3
-rw-r--r--regress/usr.bin/ssh/keytype.sh48
2 files changed, 50 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile
index 1b2f3e9a932..6f38a8c4004 100644
--- a/regress/usr.bin/ssh/Makefile
+++ b/regress/usr.bin/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.55 2010/08/31 12:24:25 djm Exp $
+# $OpenBSD: Makefile,v 1.56 2010/09/02 16:12:55 markus Exp $
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9
@@ -46,6 +46,7 @@ LTESTS= connect \
localcommand \
forcecommand \
portnum \
+ keytype \
cert-hostkey \
cert-userkey
diff --git a/regress/usr.bin/ssh/keytype.sh b/regress/usr.bin/ssh/keytype.sh
new file mode 100644
index 00000000000..7be3cc0c88b
--- /dev/null
+++ b/regress/usr.bin/ssh/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